summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorChad Rosier <mcrosier@codeaurora.org>2016-06-24 13:32:22 +0000
committerChad Rosier <mcrosier@codeaurora.org>2016-06-24 13:32:22 +0000
commit238d855bdcdc1ac515b8f10b89dd358754d94bd6 (patch)
treeb79a2094b96b0813c1a0c82373d559aef6c73a9a /include
parent7758422e2a1e07770b1c77b877f25bfe530a4bee (diff)
[MachineDominatorTree] Add a MDT verifier.
Differential Revision: http://reviews.llvm.org/D21657 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273678 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/CodeGen/MachineDominators.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/include/llvm/CodeGen/MachineDominators.h b/include/llvm/CodeGen/MachineDominators.h
index a69936f6e26..ed7cc277e8b 100644
--- a/include/llvm/CodeGen/MachineDominators.h
+++ b/include/llvm/CodeGen/MachineDominators.h
@@ -216,6 +216,8 @@ public:
void releaseMemory() override;
+ void verifyAnalysis() const override;
+
void print(raw_ostream &OS, const Module*) const override;
/// \brief Record that the critical edge (FromBB, ToBB) has been
@@ -239,6 +241,27 @@ public:
"A basic block inserted via edge splitting cannot appear twice");
CriticalEdgesToSplit.push_back({FromBB, ToBB, NewBB});
}
+
+ /// \brief Returns *false* if the other dominator tree matches this dominator
+ /// tree.
+ inline bool compare(const MachineDominatorTree &Other) const {
+ const MachineDomTreeNode *R = getRootNode();
+ const MachineDomTreeNode *OtherR = Other.getRootNode();
+
+ if (!R || !OtherR || R->getBlock() != OtherR->getBlock())
+ return true;
+
+ if (DT->compare(*Other.DT))
+ return true;
+
+ return false;
+ }
+
+ /// \brief Verify the correctness of the domtree by re-computing it.
+ ///
+ /// This should only be used for debugging as it aborts the program if the
+ /// verification fails.
+ void verifyDomTree() const;
};
//===-------------------------------------