diff options
Diffstat (limited to 'lib/IR/Dominators.cpp')
-rw-r--r-- | lib/IR/Dominators.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/lib/IR/Dominators.cpp b/lib/IR/Dominators.cpp index 37e735251fdfa..9bd0e297f4ef8 100644 --- a/lib/IR/Dominators.cpp +++ b/lib/IR/Dominators.cpp @@ -63,15 +63,22 @@ bool BasicBlockEdge::isSingleEdge() const { template class llvm::DomTreeNodeBase<BasicBlock>; template class llvm::DominatorTreeBase<BasicBlock>; -template void llvm::Calculate<Function, BasicBlock *>( +template void llvm::DomTreeBuilder::Calculate<Function, BasicBlock *>( DominatorTreeBase< typename std::remove_pointer<GraphTraits<BasicBlock *>::NodeRef>::type> &DT, Function &F); -template void llvm::Calculate<Function, Inverse<BasicBlock *>>( +template void llvm::DomTreeBuilder::Calculate<Function, Inverse<BasicBlock *>>( DominatorTreeBase<typename std::remove_pointer< GraphTraits<Inverse<BasicBlock *>>::NodeRef>::type> &DT, Function &F); +template bool llvm::DomTreeBuilder::Verify<BasicBlock *>( + const DominatorTreeBase< + typename std::remove_pointer<GraphTraits<BasicBlock *>::NodeRef>::type> + &DT); +template bool llvm::DomTreeBuilder::Verify<Inverse<BasicBlock *>>( + const DominatorTreeBase<typename std::remove_pointer< + GraphTraits<Inverse<BasicBlock *>>::NodeRef>::type> &DT); bool DominatorTree::invalidate(Function &F, const PreservedAnalyses &PA, FunctionAnalysisManager::Invalidator &) { @@ -285,6 +292,13 @@ bool DominatorTree::isReachableFromEntry(const Use &U) const { } void DominatorTree::verifyDomTree() const { + // Perform the expensive checks only when VerifyDomInfo is set. + if (VerifyDomInfo && !verify()) { + errs() << "\n~~~~~~~~~~~\n\t\tDomTree verification failed!\n~~~~~~~~~~~\n"; + print(errs()); + abort(); + } + Function &F = *getRoot()->getParent(); DominatorTree OtherDT; |