[llvm] a9f312c - [AST] Use BatchAA in aliasesUnknownInst() (NFCI)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 9 06:55:02 PDT 2022
Author: Nikita Popov
Date: 2022-09-09T15:54:48+02:00
New Revision: a9f312c7f4ff57911908c7e4b888475b9a0a6a2a
URL: https://github.com/llvm/llvm-project/commit/a9f312c7f4ff57911908c7e4b888475b9a0a6a2a
DIFF: https://github.com/llvm/llvm-project/commit/a9f312c7f4ff57911908c7e4b888475b9a0a6a2a.diff
LOG: [AST] Use BatchAA in aliasesUnknownInst() (NFCI)
Added:
Modified:
llvm/include/llvm/Analysis/AliasSetTracker.h
llvm/lib/Analysis/AliasSetTracker.cpp
llvm/lib/Transforms/Scalar/LICM.cpp
llvm/lib/Transforms/Scalar/LoopRerollPass.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/Analysis/AliasSetTracker.h b/llvm/include/llvm/Analysis/AliasSetTracker.h
index 78f5545ab215a..179ec457abc52 100644
--- a/llvm/include/llvm/Analysis/AliasSetTracker.h
+++ b/llvm/include/llvm/Analysis/AliasSetTracker.h
@@ -37,6 +37,7 @@ class AliasSetTracker;
class AnyMemSetInst;
class AnyMemTransferInst;
class BasicBlock;
+class BatchAAResults;
class LoadInst;
class raw_ostream;
class StoreInst;
@@ -311,7 +312,7 @@ class AliasSet : public ilist_node<AliasSet> {
/// set return the appropriate AliasResult. Otherwise return NoAlias.
AliasResult aliasesPointer(const Value *Ptr, LocationSize Size,
const AAMDNodes &AAInfo, AAResults &AA) const;
- bool aliasesUnknownInst(const Instruction *Inst, AAResults &AA) const;
+ bool aliasesUnknownInst(const Instruction *Inst, BatchAAResults &AA) const;
};
inline raw_ostream& operator<<(raw_ostream &OS, const AliasSet &AS) {
diff --git a/llvm/lib/Analysis/AliasSetTracker.cpp b/llvm/lib/Analysis/AliasSetTracker.cpp
index b0f90619009c7..f53a4c49df943 100644
--- a/llvm/lib/Analysis/AliasSetTracker.cpp
+++ b/llvm/lib/Analysis/AliasSetTracker.cpp
@@ -228,7 +228,7 @@ AliasResult AliasSet::aliasesPointer(const Value *Ptr, LocationSize Size,
}
bool AliasSet::aliasesUnknownInst(const Instruction *Inst,
- AliasAnalysis &AA) const {
+ BatchAAResults &AA) const {
if (AliasAny)
return true;
@@ -299,9 +299,10 @@ AliasSet *AliasSetTracker::mergeAliasSetsForPointer(const Value *Ptr,
}
AliasSet *AliasSetTracker::findAliasSetForUnknownInst(Instruction *Inst) {
+ BatchAAResults BatchAA(AA);
AliasSet *FoundSet = nullptr;
for (AliasSet &AS : llvm::make_early_inc_range(*this)) {
- if (AS.Forward || !AS.aliasesUnknownInst(Inst, AA))
+ if (AS.Forward || !AS.aliasesUnknownInst(Inst, BatchAA))
continue;
if (!FoundSet) {
// If this is the first alias set ptr can go into, remember it.
diff --git a/llvm/lib/Transforms/Scalar/LICM.cpp b/llvm/lib/Transforms/Scalar/LICM.cpp
index 48958dc55ed0d..37929d0098ed7 100644
--- a/llvm/lib/Transforms/Scalar/LICM.cpp
+++ b/llvm/lib/Transforms/Scalar/LICM.cpp
@@ -2254,12 +2254,13 @@ collectPromotionCandidates(MemorySSA *MSSA, AliasAnalysis *AA, Loop *L) {
return {}; // Nothing to promote...
// Discard any sets for which there is an aliasing non-promotable access.
+ BatchAAResults BatchAA(*AA);
foreachMemoryAccess(MSSA, L, [&](Instruction *I) {
if (AttemptingPromotion.contains(I))
return;
llvm::erase_if(Sets, [&](const AliasSet *AS) {
- return AS->aliasesUnknownInst(I, *AA);
+ return AS->aliasesUnknownInst(I, BatchAA);
});
});
diff --git a/llvm/lib/Transforms/Scalar/LoopRerollPass.cpp b/llvm/lib/Transforms/Scalar/LoopRerollPass.cpp
index f4ef225623416..8ea1a565f349f 100644
--- a/llvm/lib/Transforms/Scalar/LoopRerollPass.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopRerollPass.cpp
@@ -1326,15 +1326,17 @@ bool LoopReroll::DAGRootTracker::validate(ReductionTracker &Reductions) {
// Make sure that we don't alias with any instruction in the alias set
// tracker. If we do, then we depend on a future iteration, and we
// can't reroll.
- if (RootInst->mayReadFromMemory())
+ if (RootInst->mayReadFromMemory()) {
+ BatchAAResults BatchAA(*AA);
for (auto &K : AST) {
- if (K.aliasesUnknownInst(RootInst, *AA)) {
+ if (K.aliasesUnknownInst(RootInst, BatchAA)) {
LLVM_DEBUG(dbgs() << "LRR: iteration root match failed at "
<< *BaseInst << " vs. " << *RootInst
<< " (depends on future store)\n");
return false;
}
}
+ }
// If we've past an instruction from a future iteration that may have
// side effects, and this instruction might also, then we can't reorder
More information about the llvm-commits
mailing list