[PATCH] D111578: [LoopSimplifyCFG] Do not require MSSA. Continue to preserve if available.
Alina Sbirlea via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 11 13:56:29 PDT 2021
asbirlea created this revision.
asbirlea added reviewers: aeubanks, nikic.
Herald added subscribers: george.burgess.iv, hiraditya.
asbirlea requested review of this revision.
Herald added a project: LLVM.
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 <https://reviews.llvm.org/D109958>.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D111578
Files:
llvm/lib/Transforms/Scalar/LoopSimplifyCFG.cpp
Index: llvm/lib/Transforms/Scalar/LoopSimplifyCFG.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/LoopSimplifyCFG.cpp
+++ llvm/lib/Transforms/Scalar/LoopSimplifyCFG.cpp
@@ -733,19 +733,22 @@
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);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111578.378788.patch
Type: text/x-patch
Size: 1480 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211011/e55efd1a/attachment.bin>
More information about the llvm-commits
mailing list