[PATCH] [DomTree] Add API forceVerifyDomTree

Adam Nemet anemet at apple.com
Wed Apr 15 16:03:51 PDT 2015


Philip,

Rather than introducing another API flag besides the -verify-dom-info
command-line flag, I've decided to clean this up.

The new commit log should explain the situation:

  [DomTree] verifyDomTree to unconditionally perform DT verification
  
  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, so I
  don't check for the flag there.

Please let me know if you're OK with this.

Thanks,
Adam


http://reviews.llvm.org/D8818

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

Index: lib/IR/Dominators.cpp
===================================================================
--- lib/IR/Dominators.cpp
+++ lib/IR/Dominators.cpp
@@ -282,9 +282,6 @@
 }
 
 void DominatorTree::verifyDomTree() const {
-  if (!VerifyDomInfo)
-    return;
-
   Function &F = *getRoot()->getParent();
 
   DominatorTree OtherDT;
@@ -350,7 +347,10 @@
   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: lib/Transforms/Scalar/PlaceSafepoints.cpp
===================================================================
--- lib/Transforms/Scalar/PlaceSafepoints.cpp
+++ lib/Transforms/Scalar/PlaceSafepoints.cpp
@@ -448,10 +448,9 @@
   // 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();
 }

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D8818.23809.patch
Type: text/x-patch
Size: 1166 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150415/ecd71379/attachment.bin>


More information about the llvm-commits mailing list