[llvm] r293033 - Do not verify dominator tree if it has no roots

Serge Pavlov via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 24 23:58:10 PST 2017


Author: sepavloff
Date: Wed Jan 25 01:58:10 2017
New Revision: 293033

URL: http://llvm.org/viewvc/llvm-project?rev=293033&view=rev
Log:
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

Modified:
    llvm/trunk/lib/CodeGen/MachineDominators.cpp
    llvm/trunk/lib/IR/Dominators.cpp
    llvm/trunk/test/CodeGen/Generic/externally_available.ll

Modified: llvm/trunk/lib/CodeGen/MachineDominators.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineDominators.cpp?rev=293033&r1=293032&r2=293033&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineDominators.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineDominators.cpp Wed Jan 25 01:58:10 2017
@@ -143,6 +143,10 @@ void MachineDominatorTree::applySplitCri
 }
 
 void MachineDominatorTree::verifyDomTree() const {
+  if (getRoots().empty())
+    // If dominator tree is unavailable, skip verification.
+    return;
+
   MachineFunction &F = *getRoot()->getParent();
 
   MachineDominatorTree OtherDT;

Modified: llvm/trunk/lib/IR/Dominators.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Dominators.cpp?rev=293033&r1=293032&r2=293033&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Dominators.cpp (original)
+++ llvm/trunk/lib/IR/Dominators.cpp Wed Jan 25 01:58:10 2017
@@ -291,6 +291,10 @@ bool DominatorTree::isReachableFromEntry
 }
 
 void DominatorTree::verifyDomTree() const {
+  if (getRoots().empty())
+    // If dominator tree is unavailable, skip verification.
+    return;
+
   Function &F = *getRoot()->getParent();
 
   DominatorTree OtherDT;

Modified: llvm/trunk/test/CodeGen/Generic/externally_available.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Generic/externally_available.ll?rev=293033&r1=293032&r2=293033&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/Generic/externally_available.ll (original)
+++ llvm/trunk/test/CodeGen/Generic/externally_available.ll Wed Jan 25 01:58:10 2017
@@ -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() {




More information about the llvm-commits mailing list