diff options
-rw-r--r-- | llvm/lib/Analysis/LoopAnalysisManager.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/Transforms/Scalar/LICM.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/Transforms/Scalar/LoopInstSimplify.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/Transforms/Scalar/LoopRotation.cpp | 5 | ||||
-rw-r--r-- | llvm/lib/Transforms/Scalar/LoopSimplifyCFG.cpp | 5 | ||||
-rw-r--r-- | llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp | 6 | ||||
-rw-r--r-- | llvm/unittests/Transforms/Scalar/LoopPassManagerTest.cpp | 12 |
7 files changed, 27 insertions, 7 deletions
diff --git a/llvm/lib/Analysis/LoopAnalysisManager.cpp b/llvm/lib/Analysis/LoopAnalysisManager.cpp index d0cfb3e7342..a10a87ce113 100644 --- a/llvm/lib/Analysis/LoopAnalysisManager.cpp +++ b/llvm/lib/Analysis/LoopAnalysisManager.cpp @@ -141,8 +141,6 @@ PreservedAnalyses llvm::getLoopPassPreservedAnalyses() { PA.preserve<LoopAnalysis>(); PA.preserve<LoopAnalysisManagerFunctionProxy>(); PA.preserve<ScalarEvolutionAnalysis>(); - if (EnableMSSALoopDependency) - PA.preserve<MemorySSAAnalysis>(); // FIXME: What we really want to do here is preserve an AA category, but that // concept doesn't exist yet. PA.preserve<AAManager>(); diff --git a/llvm/lib/Transforms/Scalar/LICM.cpp b/llvm/lib/Transforms/Scalar/LICM.cpp index f039692e201..938ee80e279 100644 --- a/llvm/lib/Transforms/Scalar/LICM.cpp +++ b/llvm/lib/Transforms/Scalar/LICM.cpp @@ -294,6 +294,8 @@ PreservedAnalyses LICMPass::run(Loop &L, LoopAnalysisManager &AM, PA.preserve<DominatorTreeAnalysis>(); PA.preserve<LoopAnalysis>(); + if (EnableMSSALoopDependency) + PA.preserve<MemorySSAAnalysis>(); return PA; } diff --git a/llvm/lib/Transforms/Scalar/LoopInstSimplify.cpp b/llvm/lib/Transforms/Scalar/LoopInstSimplify.cpp index 6df32b0129c..31191b52895 100644 --- a/llvm/lib/Transforms/Scalar/LoopInstSimplify.cpp +++ b/llvm/lib/Transforms/Scalar/LoopInstSimplify.cpp @@ -233,6 +233,8 @@ PreservedAnalyses LoopInstSimplifyPass::run(Loop &L, LoopAnalysisManager &AM, auto PA = getLoopPassPreservedAnalyses(); PA.preserveSet<CFGAnalyses>(); + if (EnableMSSALoopDependency) + PA.preserve<MemorySSAAnalysis>(); return PA; } diff --git a/llvm/lib/Transforms/Scalar/LoopRotation.cpp b/llvm/lib/Transforms/Scalar/LoopRotation.cpp index f9d78404998..e009947690a 100644 --- a/llvm/lib/Transforms/Scalar/LoopRotation.cpp +++ b/llvm/lib/Transforms/Scalar/LoopRotation.cpp @@ -54,7 +54,10 @@ PreservedAnalyses LoopRotatePass::run(Loop &L, LoopAnalysisManager &AM, if (AR.MSSA && VerifyMemorySSA) AR.MSSA->verifyMemorySSA(); - return getLoopPassPreservedAnalyses(); + auto PA = getLoopPassPreservedAnalyses(); + if (EnableMSSALoopDependency) + PA.preserve<MemorySSAAnalysis>(); + return PA; } namespace { diff --git a/llvm/lib/Transforms/Scalar/LoopSimplifyCFG.cpp b/llvm/lib/Transforms/Scalar/LoopSimplifyCFG.cpp index 9fa4afb8217..c650abb412d 100644 --- a/llvm/lib/Transforms/Scalar/LoopSimplifyCFG.cpp +++ b/llvm/lib/Transforms/Scalar/LoopSimplifyCFG.cpp @@ -701,7 +701,10 @@ PreservedAnalyses LoopSimplifyCFGPass::run(Loop &L, LoopAnalysisManager &AM, if (DeleteCurrentLoop) LPMU.markLoopAsDeleted(L, "loop-simplifycfg"); - return getLoopPassPreservedAnalyses(); + auto PA = getLoopPassPreservedAnalyses(); + if (EnableMSSALoopDependency) + PA.preserve<MemorySSAAnalysis>(); + return PA; } namespace { diff --git a/llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp b/llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp index 06d65b55890..9fba159495b 100644 --- a/llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp +++ b/llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp @@ -2861,7 +2861,11 @@ PreservedAnalyses SimpleLoopUnswitchPass::run(Loop &L, LoopAnalysisManager &AM, // Historically this pass has had issues with the dominator tree so verify it // in asserts builds. assert(AR.DT.verify(DominatorTree::VerificationLevel::Fast)); - return getLoopPassPreservedAnalyses(); + + auto PA = getLoopPassPreservedAnalyses(); + if (EnableMSSALoopDependency) + PA.preserve<MemorySSAAnalysis>(); + return PA; } namespace { diff --git a/llvm/unittests/Transforms/Scalar/LoopPassManagerTest.cpp b/llvm/unittests/Transforms/Scalar/LoopPassManagerTest.cpp index 0743cba852d..5eb8101a3df 100644 --- a/llvm/unittests/Transforms/Scalar/LoopPassManagerTest.cpp +++ b/llvm/unittests/Transforms/Scalar/LoopPassManagerTest.cpp @@ -396,11 +396,13 @@ TEST_F(LoopPassManagerTest, FunctionPassInvalidationOfLoopAnalyses) { // No need to re-run if we require again from a fresh loop pass manager. FPM.addPass(createFunctionToLoopPassAdaptor( RequireAnalysisLoopPass<MockLoopAnalysisHandle::Analysis>())); - // For 'f', preserve most things but not the specific loop analyses. + auto PA = getLoopPassPreservedAnalyses(); + if (EnableMSSALoopDependency) + PA.preserve<MemorySSAAnalysis>(); EXPECT_CALL(MFPHandle, run(HasName("f"), _)) .InSequence(FSequence) - .WillOnce(Return(getLoopPassPreservedAnalyses())); + .WillOnce(Return(PA)); EXPECT_CALL(MLAHandle, invalidate(HasName("loop.0.0"), _, _)) .InSequence(FSequence) .WillOnce(DoDefault()); @@ -475,6 +477,8 @@ TEST_F(LoopPassManagerTest, ModulePassInvalidationOfLoopAnalyses) { EXPECT_CALL(MMPHandle, run(_, _)).WillOnce(InvokeWithoutArgs([] { auto PA = getLoopPassPreservedAnalyses(); PA.preserve<FunctionAnalysisManagerModuleProxy>(); + if (EnableMSSALoopDependency) + PA.preserve<MemorySSAAnalysis>(); return PA; })); // All the loop analyses from both functions get invalidated before we @@ -803,6 +807,8 @@ TEST_F(LoopPassManagerTest, IndirectOuterPassInvalidation) { // the fact that they were preserved. EXPECT_CALL(MFPHandle, run(HasName("f"), _)).WillOnce(InvokeWithoutArgs([] { auto PA = getLoopPassPreservedAnalyses(); + if (EnableMSSALoopDependency) + PA.preserve<MemorySSAAnalysis>(); PA.preserveSet<AllAnalysesOn<Loop>>(); return PA; })); @@ -824,6 +830,8 @@ TEST_F(LoopPassManagerTest, IndirectOuterPassInvalidation) { // Which means that no extra invalidation occurs and cached values are used. EXPECT_CALL(MFPHandle, run(HasName("g"), _)).WillOnce(InvokeWithoutArgs([] { auto PA = getLoopPassPreservedAnalyses(); + if (EnableMSSALoopDependency) + PA.preserve<MemorySSAAnalysis>(); PA.preserveSet<AllAnalysesOn<Loop>>(); return PA; })); |