This is an archive of the discontinued LLVM Phabricator instance.

[LoopSimplifyCFG] Don't delete LCSSA Phis
ClosedPublic

Authored by mkazantsev on Nov 22 2018, 10:11 PM.

Details

Summary

When removing edges, we also update Phi inputs and may end up removing
a Phi if it has only one input. We should not do it for edges that leave the current
loop because these Phis are LCSSA Phis and need to be preserved.

Diff Detail

Repository
rL LLVM

Event Timeline

skatkov accepted this revision.Nov 22 2018, 10:20 PM

Feel free to mention @dmgreen in description who found this bug.

This revision is now accepted and ready to land.Nov 22 2018, 10:20 PM
This revision was automatically updated to reflect the committed changes.

Thanks for the fix!

Just an FYI for how we found this, we have this pass enabled at a slightly different position in the pipeline. It's on essentially just after loop deletion, before the simple loop unrolling, hence Oliver found this as part of his csmith running. If you are running any random testing like csmith, it may be worth trying to enable the pass at a few other points in the pipeline to see if anything pops up.