[PATCH] D28767: Do not verify Dominator tree if it has no roots

Serge Pavlov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 16 03:35:55 PST 2017


sepavloff created this revision.
sepavloff added a reviewer: mcrosier.
sepavloff added subscribers: llvm-commits, davide.

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.


https://reviews.llvm.org/D28767

Files:
  lib/CodeGen/MachineDominators.cpp
  test/CodeGen/Generic/externally_available.ll


Index: test/CodeGen/Generic/externally_available.ll
===================================================================
--- test/CodeGen/Generic/externally_available.ll
+++ 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() {
Index: lib/CodeGen/MachineDominators.cpp
===================================================================
--- lib/CodeGen/MachineDominators.cpp
+++ lib/CodeGen/MachineDominators.cpp
@@ -143,6 +143,11 @@
 }
 
 void MachineDominatorTree::verifyDomTree() const {
+  if (getRoots().empty())
+    // If no roots found in the dominator tree, the pass that builds it is
+    // likely to be skipped.
+    return;
+
   MachineFunction &F = *getRoot()->getParent();
 
   MachineDominatorTree OtherDT;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28767.84540.patch
Type: text/x-patch
Size: 931 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170116/79208db9/attachment.bin>


More information about the llvm-commits mailing list