[PATCH] D41298: [PDT] Add verifyDomTree and verifyAnalysis for Post Dom Trees

Jakub Kuderski via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 19 13:46:56 PST 2018


kuhar added reviewers: dberlin, brzycki, grosser.
kuhar added a comment.

My impression was that `DT.verifyDomTree()` was mostly there for legacy reasons, as it doesn't verify that the tree is correct or that it's even constructed correctly. It has historically been quite cheap, so some passes thought they can use it in asserts, and because of this we cannot replace it with `DT.verify()`, as it can blow up in pathological cases (O(N^3)).

I am more and more convinced that `verifyDomTree()` should be replaced altogether with two or three checks:

- full verification as it is today in `.verify()`, used when `-verify-dom-info` is passes.
- partial verification: reachability, roots, parent property, dfs numbers, and comparison with a freshly build tree. This would be O(N^2), just like `verifyDomTree()` now, but probably a bit slower in practise. This would be used with EXPENSIVE_CHECKS and in `verifyAnalysis`.
- 'light' version: reachability, roots, dfs numbers, and comparison with a freshly build tree. This would be used with asserts in passes, instead of `verifyDomTree()`. This is should take about the same time ass the current implementation.

If we moved forward in this direction, all what DomTree and PostDomTree would have to implement would be essentially:

  PostDominatorTree::verifyDomTree() const { assert(verify(CheckLevel::Light)); }


https://reviews.llvm.org/D41298





More information about the llvm-commits mailing list