aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Scalar/LoopPassManager.cpp
diff options
context:
space:
mode:
authorArthur Eubanks <aeubanks@google.com>2021-03-19 14:30:48 -0700
committerArthur Eubanks <aeubanks@google.com>2021-03-19 14:56:37 -0700
commita17394dc88cccc669b8c16f8ba8f40f546dafc1b (patch)
tree275269fe1ddcc65e138f33bd0704ade0b1e175dd /llvm/lib/Transforms/Scalar/LoopPassManager.cpp
parent4773dd5ba9993e127586a5e5b1993d431a47372c (diff)
downloadllvm-a17394dc88cccc669b8c16f8ba8f40f546dafc1b.zip
llvm-a17394dc88cccc669b8c16f8ba8f40f546dafc1b.tar.gz
llvm-a17394dc88cccc669b8c16f8ba8f40f546dafc1b.tar.bz2
[NewPM] Verify LoopAnalysisResults after a loop pass
All loop passes should preserve all analyses in LoopAnalysisResults. Add checks for those when the checks are enabled (which is by default with expensive checks on). Note that due to PR44815, we don't check LAR's ScalarEvolution. Apparently calling SE.verify() can change its results. This is a reland of https://reviews.llvm.org/D98820 which was reverted due to unacceptably large compile time regressions in normal debug builds.
Diffstat (limited to 'llvm/lib/Transforms/Scalar/LoopPassManager.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/LoopPassManager.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopPassManager.cpp b/llvm/lib/Transforms/Scalar/LoopPassManager.cpp
index 60a9602..0bb3ec4 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,17 @@ 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.
+ if (VerifyDomInfo)
+ LAR.DT.verify();
+ if (VerifyLoopInfo)
+ 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())