From: Max Kazantsev Date: Mon, 30 May 2022 10:28:33 +0000 (+0700) Subject: [MemDep][NFC] Remove duplicating check in `if` and `else` branch X-Git-Tag: upstream/15.0.7~6403 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7e5a730473a7b2909cc3a4b9198d8418c8146372;p=platform%2Fupstream%2Fllvm.git [MemDep][NFC] Remove duplicating check in `if` and `else` branch Same check is done whether the condition is true or false. Just hoist it out of conditional. --- diff --git a/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp b/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp index c1ca9a9..586cac6 100644 --- a/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp +++ b/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp @@ -502,10 +502,10 @@ MemDepResult MemoryDependenceResults::getSimplePointerDependencyFrom( // If we found a pointer, check if it could be the same as our pointer. AliasResult R = BatchAA.alias(LoadLoc, MemLoc); - if (isLoad) { - if (R == AliasResult::NoAlias) - continue; + if (R == AliasResult::NoAlias) + continue; + if (isLoad) { // Must aliased loads are defs of each other. if (R == AliasResult::MustAlias) return MemDepResult::getDef(Inst); @@ -522,10 +522,6 @@ MemDepResult MemoryDependenceResults::getSimplePointerDependencyFrom( continue; } - // Stores don't depend on other no-aliased accesses. - if (R == AliasResult::NoAlias) - continue; - // Stores don't alias loads from read-only memory. if (BatchAA.pointsToConstantMemory(LoadLoc)) continue;