[PATCH] D61999: [DominatorTree] Print roots unconditionally in `print()`.

Clement Courbet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 16 03:43:22 PDT 2019


courbet created this revision.
courbet added reviewers: kuhar, asbirlea.
Herald added a project: LLVM.

This came up in a debugging session. I was failing to update the root of
the tree, and got during verification:

  DominatorTree is different than a freshly computed one!
          Current:
  =============================--------------------------------
  Inorder Dominator Tree: DFSNumbers invalid: 0 slow queries.
    [1] %"entry+land.rhs.i" {4294967295,4294967295} [0]
      [2] %opeq1.exit {4294967295,4294967295} [1]
  
          Freshly computed tree:
  =============================--------------------------------
  Inorder Dominator Tree: DFSNumbers invalid: 0 slow queries.
    [1] %"entry+land.rhs.i" {4294967295,4294967295} [0]
      [2] %opeq1.exit {4294967295,4294967295} [1]

We now print:

  DominatorTree is different than a freshly computed one!
          Current:
  =============================--------------------------------
  Inorder Dominator Tree: DFSNumbers invalid: 0 slow queries.
    [1] %"entry+land.rhs.i" {4294967295,4294967295} [0]
      [2] %opeq1.exit {4294967295,4294967295} [1]
  Roots: <badref>
  
          Freshly computed tree:
  =============================--------------------------------
  Inorder Dominator Tree: DFSNumbers invalid: 0 slow queries.
    [1] %"entry+land.rhs.i" {4294967295,4294967295} [0]
      [2] %opeq1.exit {4294967295,4294967295} [1]
  Roots: %"entry+land.rhs.i"


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D61999

Files:
  llvm/include/llvm/Support/GenericDomTree.h


Index: llvm/include/llvm/Support/GenericDomTree.h
===================================================================
--- llvm/include/llvm/Support/GenericDomTree.h
+++ llvm/include/llvm/Support/GenericDomTree.h
@@ -669,14 +669,12 @@
 
     // The postdom tree can have a null root if there are no returns.
     if (getRootNode()) PrintDomTree<NodeT>(getRootNode(), O, 1);
-    if (IsPostDominator) {
-      O << "Roots: ";
-      for (const NodePtr Block : Roots) {
-        Block->printAsOperand(O, false);
-        O << " ";
-      }
-      O << "\n";
+    O << "Roots: ";
+    for (const NodePtr Block : Roots) {
+      Block->printAsOperand(O, false);
+      O << " ";
     }
+    O << "\n";
   }
 
 public:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61999.199781.patch
Type: text/x-patch
Size: 713 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190516/1cddf9f8/attachment.bin>


More information about the llvm-commits mailing list