[PATCH] [DomTree] Add API forceVerifyDomTree

Adam Nemet anemet at apple.com
Thu Apr 2 23:09:26 PDT 2015


Hi hfinkel,

This API bypasses the -verify-dom-info flag to always check DT
consistency.  This is useful to stress-test a single pass without
slowing down other passes.

Looks like the LoopVectorizer was trying to do something similar when it
calls verifyDomTree directly.  That's a no-op unless -verify-dom-info is
used.  But if -verify-dom-info is passed the verification would be run
anyway.  We should probably also fix this in LV.

http://reviews.llvm.org/D8818

Files:
  include/llvm/IR/Dominators.h
  lib/IR/Dominators.cpp

Index: include/llvm/IR/Dominators.h
===================================================================
--- include/llvm/IR/Dominators.h
+++ include/llvm/IR/Dominators.h
@@ -120,6 +120,12 @@
   /// This should only be used for debugging as it aborts the program if the
   /// verification fails.
   void verifyDomTree() const;
+
+  /// \brief Same as verifyDomTree but it performs the verification even without
+  /// -verify-dom-info.
+  ///
+  /// Useful to call from a pass to stress-test DT updating.
+  void forceVerifyDomTree() const;
 };
 
 //===-------------------------------------
Index: lib/IR/Dominators.cpp
===================================================================
--- lib/IR/Dominators.cpp
+++ lib/IR/Dominators.cpp
@@ -284,7 +284,10 @@
 void DominatorTree::verifyDomTree() const {
   if (!VerifyDomInfo)
     return;
+  forceVerifyDomTree();
+}
 
+void DominatorTree::forceVerifyDomTree() const {
   Function &F = *getRoot()->getParent();
 
   DominatorTree OtherDT;

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


More information about the llvm-commits mailing list