[llvm-dev] LoopDeletion and use in unreachable block
Anna Thomas via llvm-dev
llvm-dev at lists.llvm.org
Wed Jan 10 06:11:54 PST 2018
[ +CC Davide, who’s been fixing these unreachable block bugs]
I think loop deletion needs to be fixed here.
For LCSSA verification in `isBlockInLCSSAForm`, we specifically ignore uses in blocks that are not reachable from entry.
We do not need phis for such uses.
So, a loop can be in LCSSA form and still have unreachable uses for def’s and not have phis for those defs.
Although loop deletion uses a reasonable (and AFAICT correct) logic for identifying “invariant” loops by depending on the fact that LCSSA is preserved.
it needs to take into account unreachable uses before deleting that invariant loop.
On Jan 10, 2018, at 4:00 AM, Serguei Katkov via llvm-dev <llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org>> wrote:
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.
LLVM Developers mailing list
llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org>
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev