Skip to content

Commit 634948e

Browse files
committed
Call BatchAA.alias() only once then check AAResult
1 parent e9c9941 commit 634948e

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

llvm/include/llvm/Analysis/AliasAnalysis.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -667,10 +667,6 @@ class BatchAAResults {
667667
MemoryLocation(V2, LocationSize::precise(1))) ==
668668
AliasResult::MustAlias;
669669
}
670-
bool isNoAlias(const Value *V1, const Value *V2) {
671-
return alias(MemoryLocation::getBeforeOrAfter(V1),
672-
MemoryLocation::getBeforeOrAfter(V2)) == AliasResult::NoAlias;
673-
}
674670
ModRefInfo callCapturesBefore(const Instruction *I,
675671
const MemoryLocation &MemLoc,
676672
DominatorTree *DT) {

llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -910,9 +910,11 @@ getInitializesArgMemLoc(const Instruction *I, BatchAAResults &BatchAA) {
910910
Value *CurArg = CB->getArgOperand(Idx);
911911
bool FoundAliasing = false;
912912
for (auto &[Arg, AliasList] : Arguments) {
913-
if (BatchAA.isNoAlias(Arg, CurArg)) {
913+
auto AAR = BatchAA.alias(MemoryLocation::getBeforeOrAfter(Arg),
914+
MemoryLocation::getBeforeOrAfter(CurArg));
915+
if (AAR == AliasResult::NoAlias) {
914916
continue;
915-
} else if (BatchAA.isMustAlias(Arg, CurArg)) {
917+
} else if (AAR == AliasResult::MustAlias) {
916918
FoundAliasing = true;
917919
AliasList.push_back(InitInfo);
918920
} else {

0 commit comments

Comments
 (0)