Skip to content

Commit

Permalink
[DominatorTree] Print roots unconditionally in print().
Browse files Browse the repository at this point in the history
Summary:
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"
```

Reviewers: kuhar, asbirlea

Subscribers: llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D61999

llvm-svn: 360886
  • Loading branch information
legrosbuffle committed May 16, 2019
1 parent ab15546 commit 3a0e6e1
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions llvm/include/llvm/Support/GenericDomTree.h
Expand Up @@ -669,14 +669,12 @@ class DominatorTreeBase {

// 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:
Expand Down

0 comments on commit 3a0e6e1

Please sign in to comment.