[PATCH] D16637: [SimplifyCFG] limit recursion depth when speculating instructions (PR26308)

David Majnemer via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 27 10:50:13 PST 2016


majnemer added a comment.

In http://reviews.llvm.org/D16637#337486, @dberlin wrote:

> If you do it on literally every two entry phi nodes, why is the answer not:
>
> Number each node of dominator tree with depth in dom tree (IE level).
>  Process dominator tree in level order, visiting all nodes of a given level
>  before the next deeper level:
>
>   Try to speculate a given phi node.
>   Stop anytime you hit a phi node with a level above you above you (because
>
> you will have already speculated it if you could).
>
>   Track visited phi nodes to avoid cycles.
>   
>   
>
> Or something similar.
>  Over time, we seem to expand a lot of lazy-walking optimizations to do
>  these "walk possibly everything backwards" types of algorithms, and at the
>  point we want to walk *everything of a certain type* there is no point in
>  doing it lazily.


You will find no disagreement on this point from me :)
On the other hand, there is no reason not to apply this patch.  The code as-written obviously intended to do something with this recursion depth counter, it's disuse was an oversight.


http://reviews.llvm.org/D16637





More information about the llvm-commits mailing list