summaryrefslogtreecommitdiff
path: root/lib/Analysis/PostDominators.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Analysis/PostDominators.cpp')
-rw-r--r--lib/Analysis/PostDominators.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/Analysis/PostDominators.cpp b/lib/Analysis/PostDominators.cpp
index 2282401085d4..e6b660fe26d7 100644
--- a/lib/Analysis/PostDominators.cpp
+++ b/lib/Analysis/PostDominators.cpp
@@ -21,6 +21,12 @@ using namespace llvm;
#define DEBUG_TYPE "postdomtree"
+#ifdef EXPENSIVE_CHECKS
+static constexpr bool ExpensiveChecksEnabled = true;
+#else
+static constexpr bool ExpensiveChecksEnabled = false;
+#endif
+
//===----------------------------------------------------------------------===//
// PostDominatorTree Implementation
//===----------------------------------------------------------------------===//
@@ -44,6 +50,13 @@ bool PostDominatorTreeWrapperPass::runOnFunction(Function &F) {
return false;
}
+void PostDominatorTreeWrapperPass::verifyAnalysis() const {
+ if (VerifyDomInfo)
+ assert(DT.verify(PostDominatorTree::VerificationLevel::Full));
+ else if (ExpensiveChecksEnabled)
+ assert(DT.verify(PostDominatorTree::VerificationLevel::Basic));
+}
+
void PostDominatorTreeWrapperPass::print(raw_ostream &OS, const Module *) const {
DT.print(OS);
}
@@ -56,8 +69,7 @@ AnalysisKey PostDominatorTreeAnalysis::Key;
PostDominatorTree PostDominatorTreeAnalysis::run(Function &F,
FunctionAnalysisManager &) {
- PostDominatorTree PDT;
- PDT.recalculate(F);
+ PostDominatorTree PDT(F);
return PDT;
}