[llvm] f7ca542 - [LoopSimplifyCFG] Do not require MSSA. Continue to preserve if available.
Alina Sbirlea via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 11 14:27:50 PDT 2021
Author: Alina Sbirlea
Date: 2021-10-11T14:27:15-07:00
New Revision: f7ca54289c1466e47eb5e77a9e3f751f13223428
URL: https://github.com/llvm/llvm-project/commit/f7ca54289c1466e47eb5e77a9e3f751f13223428
DIFF: https://github.com/llvm/llvm-project/commit/f7ca54289c1466e47eb5e77a9e3f751f13223428.diff
LOG: [LoopSimplifyCFG] Do not require MSSA. Continue to preserve if available.
LoopSimplifyCFG does not need MSSA, but should preserve it if it's available.
This is a legacy PM change, aimed to denoise the test changes in D109958.
Differential Revision: https://reviews.llvm.org/D111578
Added:
Modified:
llvm/lib/Transforms/Scalar/LoopSimplifyCFG.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Scalar/LoopSimplifyCFG.cpp b/llvm/lib/Transforms/Scalar/LoopSimplifyCFG.cpp
index 6fa736426e45..a87843d658a9 100644
--- a/llvm/lib/Transforms/Scalar/LoopSimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopSimplifyCFG.cpp
@@ -733,19 +733,22 @@ class LoopSimplifyCFGLegacyPass : public LoopPass {
DominatorTree &DT = getAnalysis<DominatorTreeWrapperPass>().getDomTree();
LoopInfo &LI = getAnalysis<LoopInfoWrapperPass>().getLoopInfo();
ScalarEvolution &SE = getAnalysis<ScalarEvolutionWrapperPass>().getSE();
- MemorySSA *MSSA = &getAnalysis<MemorySSAWrapperPass>().getMSSA();
- MemorySSAUpdater MSSAU(MSSA);
- if (VerifyMemorySSA)
- MSSA->verifyMemorySSA();
+ auto *MSSAA = getAnalysisIfAvailable<MemorySSAWrapperPass>();
+ Optional<MemorySSAUpdater> MSSAU;
+ if (MSSAA)
+ MSSAU = MemorySSAUpdater(&MSSAA->getMSSA());
+ if (MSSAA && VerifyMemorySSA)
+ MSSAU->getMemorySSA()->verifyMemorySSA();
bool DeleteCurrentLoop = false;
- bool Changed = simplifyLoopCFG(*L, DT, LI, SE, &MSSAU, DeleteCurrentLoop);
+ bool Changed = simplifyLoopCFG(
+ *L, DT, LI, SE, MSSAU.hasValue() ? MSSAU.getPointer() : nullptr,
+ DeleteCurrentLoop);
if (DeleteCurrentLoop)
LPM.markLoopAsDeleted(*L);
return Changed;
}
void getAnalysisUsage(AnalysisUsage &AU) const override {
- AU.addRequired<MemorySSAWrapperPass>();
AU.addPreserved<MemorySSAWrapperPass>();
AU.addPreserved<DependenceAnalysisWrapperPass>();
getLoopAnalysisUsage(AU);
More information about the llvm-commits
mailing list