[DomTree] verifyDomTree to unconditionally perform DT verification
authorAdam Nemet <anemet@apple.com>
Wed, 6 May 2015 08:18:41 +0000 (08:18 +0000)
committerAdam Nemet <anemet@apple.com>
Wed, 6 May 2015 08:18:41 +0000 (08:18 +0000)
I folded the check for the flag -verify-dom-info into the only caller
where I think it is supposed to be checked: verifyAnalysis.  (The idea
of the flag is to enable this expensive verification in
verifyPreservedAnalysis.)

I'm assuming that when manually scheduling the verification pass
with -passes=verify<domtree>, we do want to perform the verification.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236575 91177308-0d34-0410-b5e6-96231b3b80d8

lib/IR/Dominators.cpp
lib/Transforms/Scalar/PlaceSafepoints.cpp

index 9b6ff1eb1366df3f923975fdc234e9450e445e21..e3258895ea5e8814c7019925d7783529c05dfeec 100644 (file)
@@ -282,9 +282,6 @@ bool DominatorTree::isReachableFromEntry(const Use &U) const {
 }
 
 void DominatorTree::verifyDomTree() const {
-  if (!VerifyDomInfo)
-    return;
-
   Function &F = *getRoot()->getParent();
 
   DominatorTree OtherDT;
@@ -350,7 +347,10 @@ bool DominatorTreeWrapperPass::runOnFunction(Function &F) {
   return false;
 }
 
-void DominatorTreeWrapperPass::verifyAnalysis() const { DT.verifyDomTree(); }
+void DominatorTreeWrapperPass::verifyAnalysis() const {
+    if (VerifyDomInfo)
+      DT.verifyDomTree();
+}
 
 void DominatorTreeWrapperPass::print(raw_ostream &OS, const Module *) const {
   DT.print(OS);
index ffed810d823b5c613803495b5ac296fde51c140a..08e41c27c5c6ef834ab762ccd17502daf03ca829 100644 (file)
@@ -455,10 +455,9 @@ static Instruction *findLocationForEntrySafepoint(Function &F,
   // Note: SplitBlock modifies the DT.  Simply passing a Pass (which is a
   // module pass) is not enough.
   DT.recalculate(F);
-#ifndef NDEBUG
+
   // SplitBlock updates the DT
-  DT.verifyDomTree();
-#endif
+  DEBUG(DT.verifyDomTree());
 
   return BB->getTerminator();
 }