[PATCH] D42337: [Dominators] Introduce DomTree verification levels

Daniel Berlin via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 20 13:35:17 PST 2018


I assume if we ever bothered to make the verification O(N) again using
better algorithms, we'd go back to one level of verification?

On Sat, Jan 20, 2018 at 3:30 PM, Jakub Kuderski via Phabricator <
reviews at reviews.llvm.org> wrote:

> kuhar created this revision.
> kuhar added reviewers: dberlin, brzycki, davide, grosser, dmgreen.
>
> Currently, there are 2 ways to verify a DomTree:
>
> - `DT.verify()` -- runs full tree verification and checks all the
> properties and gives a reason why the tree is incorrect. This is run by
> when EXPENSIVE_CHECKS are enabled or when `-verify-dom-info` flag is set.
> - `DT.verifyDominatorTree()` -- constructs a fresh tree and compares it
> against the old one. This does not check any other tree properties (DFS
> number, levels), nor ensures that the construction algorithm is correct.
> Used by some passes inside assertions.
>
> This patch introduces DomTree verification levels, that try to close the
> gape between the two ways of checking trees by introducing 3 verification
> levels:
>
> - Full -- checks all properties, but can be slow (O(N^3)). Used when
> manually requested (e.g. `assert(DT.verify())`) or when  `-verify-dom-info`
> is set.
> - Basic -- checks all properties except the sibling property, and compares
> the current tree with a freshly constructed one instead. This should catch
> almost all errors, but does not guarantee that the construction algorithm
> is correct. Used when EXPENSIVE checks are enabled.
> - Fast -- checks only basic properties (reachablility, dfs numbers,
> levels, roots), and compares with a fresh tree. This is meant to replace
> the legacy `DT.verifyDominatorTree()` and in my tests doesn't cause any
> noticeable performance impact even in the most pessimistic examples.
>
> When used to verify dom tree wrapper pass analysis on sqlite3, the 3 new
> levels make `opt -O3` take the following amount of time on my machine:
>
> - no verification: 8.3s
> - `DT.verify(VerificationLevel::Fast)`: 10.1s
> - `DT.verify(VerificationLevel::Basic)`: 44.8s
> - `DT.verify(VerificationLevel::Basic)`: 1m 46.2s
>
> (and the previous `DT.verifyDominatorTree()` is within the noise of the
> Fast level)
>
> This patch makes `DT.verifyDominatorTree()` pick between the 3
> verification levels depending on EXPENSIVE_CHECKS and `-verify-dom-info`.
>
>
> Repository:
>   rL LLVM
>
> https://reviews.llvm.org/D42337
>
> Files:
>   include/llvm/IR/Dominators.h
>   include/llvm/Support/GenericDomTree.h
>   include/llvm/Support/GenericDomTreeConstruction.h
>   lib/IR/Dominators.cpp
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180120/9ca3409f/attachment.html>


More information about the llvm-commits mailing list