]> granicus.if.org Git - llvm/commitdiff
Do not verify dominator tree if it has no roots
authorSerge Pavlov <sepavloff@gmail.com>
Wed, 25 Jan 2017 07:58:10 +0000 (07:58 +0000)
committerSerge Pavlov <sepavloff@gmail.com>
Wed, 25 Jan 2017 07:58:10 +0000 (07:58 +0000)
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293033 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/MachineDominators.cpp
lib/IR/Dominators.cpp
test/CodeGen/Generic/externally_available.ll

index 303a6a9263be7a51c81cc7ccc1c23386f40e48b0..4e34887769777633ea71dced17e550b028dce086 100644 (file)
@@ -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;
index 44948cc5831d785c0daaca63f5341233b2e79c70..392670bbd29c4c2895031ad5d564ef74cf7867ba 100644 (file)
@@ -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;
index 7976cc971880f117b49f248885808291d77c93a8..2376bc7399277c40a7fc1973c831aab20d190c9f 100644 (file)
@@ -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() {