[llvm] 7e5a730 - [MemDep][NFC] Remove duplicating check in `if` and `else` branch
Max Kazantsev via llvm-commits
llvm-commits at lists.llvm.org
Mon May 30 03:43:23 PDT 2022
Author: Max Kazantsev
Date: 2022-05-30T17:43:00+07:00
New Revision: 7e5a730473a7b2909cc3a4b9198d8418c8146372
URL: https://github.com/llvm/llvm-project/commit/7e5a730473a7b2909cc3a4b9198d8418c8146372
DIFF: https://github.com/llvm/llvm-project/commit/7e5a730473a7b2909cc3a4b9198d8418c8146372.diff
LOG: [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.
Added:
Modified:
llvm/lib/Analysis/MemoryDependenceAnalysis.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp b/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp
index c1ca9a9c5692..586cac6c3f20 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;
More information about the llvm-commits
mailing list