[PATCH] D31843: [LCSSA] Try to not walk the dominator tree more than necessary

Davide Italiano via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 10 16:31:25 PDT 2017


davide added a comment.

In https://reviews.llvm.org/D31843#722830, @mzolotukhin wrote:

> If the slow part is checking if the block dominates any exit, how about we precompute set of blocks meeting this requirement in advance?
>
> E.g. if we start from the set of exiting blocks and go up the dom-tree until we hit the loop header, we should end up with a set of blocks dominating at least one exit. Would it be faster than what we have now?


That's only one part of the slowdown. The other bit is that apparently doing repeated lookups in the maps `BasicBlock * -> DomTreeNode *`, i.e. `getNode()` is expensive. The patch in my previous comment tries to work-around with an hack precomputing the set once and reusing. If I understand the newly proposed algorithm, it should reduce the number of redundant Dom lookups as a side effect, so we should be fine.


https://reviews.llvm.org/D31843





More information about the llvm-commits mailing list