[llvm-dev] LoopDeletion and use in unreachable block

Serguei Katkov via llvm-dev llvm-dev at lists.llvm.org
Wed Jan 10 01:00:22 PST 2018

Hello All,

I filed a bug https://bugs.llvm.org/show_bug.cgi?id=35884 which I want to fix but I'm in trouble with detecting who is wrong :)

The story is as follows:
LoopDeletion tries to delete an invariant loop which has a def with use in some unreachable block.
The IR is well-formed due to any use in unreachable block is dominated as Verifier states.

LoopDeletion detected the loop as invariant due to LCSSA builder did not create a Phi node for this def because this def is in
block which does not dominate exit.

When BB with def is destroyed the destroying of def instruction causes an assert due to it has use.

So I wonder who is wrong here:
1) LCSSA which did not create a Phi node
2) LoopDeletion which did not take into account that instruction can be used in unreachable block and used a bulk deletion.

Any help is appreciated.

Thank you,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180110/9749a7c2/attachment.html>

More information about the llvm-dev mailing list