summaryrefslogtreecommitdiff
path: root/lib/IR/Dominators.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-07-01 13:22:02 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-07-01 13:22:02 +0000
commit9df3605dea17e84f8183581f6103bd0c79e2a606 (patch)
tree70a2f36ce9eb9bb213603cd7f2f120af53fc176f /lib/IR/Dominators.cpp
parent08bbd35a80bf7765fe0d3043f9eb5a2f2786b649 (diff)
Diffstat (limited to 'lib/IR/Dominators.cpp')
-rw-r--r--lib/IR/Dominators.cpp18
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;