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;