From 9df3605dea17e84f8183581f6103bd0c79e2a606 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sat, 1 Jul 2017 13:22:02 +0000 Subject: Vendor import of llvm trunk r306956: https://llvm.org/svn/llvm-project/llvm/trunk@306956 --- lib/IR/Dominators.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'lib/IR/Dominators.cpp') 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; template class llvm::DominatorTreeBase; -template void llvm::Calculate( +template void llvm::DomTreeBuilder::Calculate( DominatorTreeBase< typename std::remove_pointer::NodeRef>::type> &DT, Function &F); -template void llvm::Calculate>( +template void llvm::DomTreeBuilder::Calculate>( DominatorTreeBase>::NodeRef>::type> &DT, Function &F); +template bool llvm::DomTreeBuilder::Verify( + const DominatorTreeBase< + typename std::remove_pointer::NodeRef>::type> + &DT); +template bool llvm::DomTreeBuilder::Verify>( + const DominatorTreeBase>::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; -- cgit v1.2.3