summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSerge Pavlov <sepavloff@gmail.com>2017-01-25 07:58:10 +0000
committerSerge Pavlov <sepavloff@gmail.com>2017-01-25 07:58:10 +0000
commit43a7759f4b67199d0e8eebfd19d5bf42a8b364b5 (patch)
treee105c6ce6134862fcd03ffdc09ef1174005049d0
parentac03b4b924eee5f1f9105b3119ccecb16b89f206 (diff)
downloadbcm5719-llvm-43a7759f4b67199d0e8eebfd19d5bf42a8b364b5.tar.gz
bcm5719-llvm-43a7759f4b67199d0e8eebfd19d5bf42a8b364b5.zip
Do not verify dominator tree if it has no roots
If dominator tree has no roots, the pass that calculates it is likely to be skipped. It occures, for instance, in the case of entities with linkage available_externally. Do not run tree verification in such case. Differential Revision: https://reviews.llvm.org/D28767 llvm-svn: 293033
-rw-r--r--llvm/lib/CodeGen/MachineDominators.cpp4
-rw-r--r--llvm/lib/IR/Dominators.cpp4
-rw-r--r--llvm/test/CodeGen/Generic/externally_available.ll2
3 files changed, 9 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/MachineDominators.cpp b/llvm/lib/CodeGen/MachineDominators.cpp
index 303a6a9263b..4e348877697 100644
--- a/llvm/lib/CodeGen/MachineDominators.cpp
+++ b/llvm/lib/CodeGen/MachineDominators.cpp
@@ -143,6 +143,10 @@ void MachineDominatorTree::applySplitCriticalEdges() const {
}
void MachineDominatorTree::verifyDomTree() const {
+ if (getRoots().empty())
+ // If dominator tree is unavailable, skip verification.
+ return;
+
MachineFunction &F = *getRoot()->getParent();
MachineDominatorTree OtherDT;
diff --git a/llvm/lib/IR/Dominators.cpp b/llvm/lib/IR/Dominators.cpp
index 44948cc5831..392670bbd29 100644
--- a/llvm/lib/IR/Dominators.cpp
+++ b/llvm/lib/IR/Dominators.cpp
@@ -291,6 +291,10 @@ bool DominatorTree::isReachableFromEntry(const Use &U) const {
}
void DominatorTree::verifyDomTree() const {
+ if (getRoots().empty())
+ // If dominator tree is unavailable, skip verification.
+ return;
+
Function &F = *getRoot()->getParent();
DominatorTree OtherDT;
diff --git a/llvm/test/CodeGen/Generic/externally_available.ll b/llvm/test/CodeGen/Generic/externally_available.ll
index 7976cc97188..2376bc73992 100644
--- a/llvm/test/CodeGen/Generic/externally_available.ll
+++ b/llvm/test/CodeGen/Generic/externally_available.ll
@@ -1,4 +1,4 @@
-; RUN: llc < %s | not grep test_
+; RUN: llc -verify-machine-dom-info < %s | not grep test_
; test_function should not be emitted to the .s file.
define available_externally i32 @test_function() {
OpenPOWER on IntegriCloud