Sfoglia il codice sorgente

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293033 91177308-0d34-0410-b5e6-96231b3b80d8
Serge Pavlov 8 anni fa
parent
commit
841259051a

+ 4 - 0
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;

+ 4 - 0
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;

+ 1 - 1
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() {