[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.
This commit is contained in:
Arthur Eubanks 2021-03-19 14:30:48 -07:00
parent 4773dd5ba9
commit a17394dc88
1 changed files with 12 additions and 2 deletions

View File

@ -14,6 +14,7 @@
#include "llvm/Analysis/MemorySSA.h" #include "llvm/Analysis/MemorySSA.h"
#include "llvm/Analysis/ScalarEvolutionAliasAnalysis.h" #include "llvm/Analysis/ScalarEvolutionAliasAnalysis.h"
#include "llvm/Analysis/TargetLibraryInfo.h" #include "llvm/Analysis/TargetLibraryInfo.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/TimeProfiler.h" #include "llvm/Support/TimeProfiler.h"
using namespace llvm; using namespace llvm;
@ -291,8 +292,17 @@ PreservedAnalyses FunctionToLoopPassAdaptor::run(Function &F,
else else
PI.runAfterPass<Loop>(*Pass, *L, PassPA); PI.runAfterPass<Loop>(*Pass, *L, PassPA);
// FIXME: We should verify the set of analyses relevant to Loop passes #ifndef NDEBUG
// are preserved. // 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 the loop hasn't been deleted, we need to handle invalidation here.
if (!Updater.skipCurrentLoop()) if (!Updater.skipCurrentLoop())