[llvm] 94c269b - [NewPM] Verify LoopAnalysisResults after a loop pass
Arthur Eubanks via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 19 13:27:14 PDT 2021
Author: Arthur Eubanks
Date: 2021-03-19T13:26:45-07:00
New Revision: 94c269baf58330a5e303a4f86f64681f2f7a858b
URL: https://github.com/llvm/llvm-project/commit/94c269baf58330a5e303a4f86f64681f2f7a858b
DIFF: https://github.com/llvm/llvm-project/commit/94c269baf58330a5e303a4f86f64681f2f7a858b.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.
Only verify MSSA when VerifyMemorySSA, normally it's very expensive.
Reviewed By: asbirlea
Differential Revision: https://reviews.llvm.org/D98820
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..bea938a7a9cc 100644
--- a/llvm/lib/Transforms/Scalar/LoopPassManager.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopPassManager.cpp
@@ -14,6 +14,7 @@
#include "llvm/Analysis/MemorySSA.h"
#include "llvm/Analysis/ScalarEvolutionAliasAnalysis.h"
#include "llvm/Analysis/TargetLibraryInfo.h"
+#include "llvm/Support/Debug.h"
#include "llvm/Support/TimeProfiler.h"
using namespace llvm;
@@ -291,8 +292,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 && VerifyMemorySSA)
+ 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