[llvm] 6db3ab2 - [NewPM] Verify LoopAnalysisResults after a loop pass

Arthur Eubanks via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 17 13:37:48 PDT 2021


Author: Arthur Eubanks
Date: 2021-03-17T13:37:22-07:00
New Revision: 6db3ab2903f42712f44000afb5aa467efbd25f35

URL: https://github.com/llvm/llvm-project/commit/6db3ab2903f42712f44000afb5aa467efbd25f35
DIFF: https://github.com/llvm/llvm-project/commit/6db3ab2903f42712f44000afb5aa467efbd25f35.diff

LOG: [NewPM] Verify LoopAnalysisResults after a loop pass

All loop passes should preserve all analyses in LoopAnalysisResults. Add
checks for those.

Note that due to PR44815, we don't check LAR's ScalarEvolution.
Apparently calling SE.verify() can change its results.

Reviewed By: asbirlea

Differential Revision: https://reviews.llvm.org/D98805

Added: 
    

Modified: 
    llvm/lib/Transforms/Scalar/LoopPassManager.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Scalar/LoopPassManager.cpp b/llvm/lib/Transforms/Scalar/LoopPassManager.cpp
index 60a9602096bb..db6661f1071c 100644
--- a/llvm/lib/Transforms/Scalar/LoopPassManager.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopPassManager.cpp
@@ -291,8 +291,15 @@ PreservedAnalyses FunctionToLoopPassAdaptor::run(Function &F,
     else
       PI.runAfterPass<Loop>(*Pass, *L, PassPA);
 
-    // FIXME: We should verify the set of analyses relevant to Loop passes
-    // are preserved.
+#ifndef NDEBUG
+    // LoopAnalysisResults should always be valid.
+    // Note that we don't LAR.SE.verify() because that can change observed SE
+    // queries. See PR44815.
+    LAR.DT.verify();
+    LAR.LI.verify(LAR.DT);
+    if (LAR.MSSA)
+      LAR.MSSA->verifyMemorySSA();
+#endif
 
     // If the loop hasn't been deleted, we need to handle invalidation here.
     if (!Updater.skipCurrentLoop())


        


More information about the llvm-commits mailing list