[PATCH] D34135: [LVI] Add initial result to avoid infinite getValueFromCondition recursion

Daniel Berlin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 14 14:17:36 PDT 2017


dberlin added a comment.

In https://reviews.llvm.org/D34135#780666, @anna wrote:

> In https://reviews.llvm.org/D34135#780637, @efriedma wrote:
>
> > The sequence here is that we constant-fold a terminator (deleting an edge), then continue iterating through all the blocks in the function, and eventually crash when LVI discovers a cycle in a loop which was made unreachable.
>
>
> So, the main problem here is that in each iteration of Jump threading, we can find the trivially dead blocks, but not the complete set of unreachable blocks. Also, I'm assuming transitively detecting dead blocks after the call to `processBlock` does not help in this case?


The set of blocks it will find will depend on input order of basic blocks currently.
It is possible to increase it to find all non-cycle involved unreachable blocks  by performing the processing in the optimal iteration order.
It should be possible to find all unreachable blocks (including those involved in cycle) as you go by forming SCC's and iterating them individually in the right order.

The "detection of dead blocks" is really a quick DCE algorithm that walks the actual instructions of blocks, etc.
Not "normal" structural detection of unreachable blocks.
(I admit to being mostly unsure why, it's not immediately clear to me why you can't structurally detect them all)

So repeated transitive detection would be kind of a band-aid. It may even be made to work.
But it would have  a much worse timebound.


https://reviews.llvm.org/D34135





More information about the llvm-commits mailing list