This is an archive of the discontinued LLVM Phabricator instance.

[LICM] Store sink and indirectbr instructions
ClosedPublic

Authored by bruno on Nov 26 2014, 3:00 AM.

Details

Summary

Loop simplify skips exit-block insertion when exits contain indirectbr instructions. This
leads to an assertion in LICM when trying to sink stores out of non-dedicated loop exits
containing indirectbr instructions. This patch fix this issue by re-checking for dedicated
exits in LICM prior to store sink attempts.

Diff Detail

Event Timeline

bruno updated this revision to Diff 16638.Nov 26 2014, 3:00 AM
bruno retitled this revision from to [LICM] Store sink and indirectbr instructions.
bruno updated this object.
bruno edited the test plan for this revision. (Show Details)
bruno added reviewers: atrick, hfinkel.
bruno set the repository for this revision to rL LLVM.
bruno added a subscriber: Unknown Object (MLST).
hfinkel accepted this revision.Nov 27 2014, 2:17 PM
hfinkel edited edge metadata.

LGTM, thanks!

Maybe LoopSimplify should create a dedicated exit block for loops like this, but that's another matter, and this seems like a reasonable change regardless (we shouldn't be sinking stores into non-dedicated exit blocks).

This revision is now accepted and ready to land.Nov 27 2014, 2:17 PM

Hi Hal,

Agreed. As a side note, this all happens because LoopSimplify avoids dealing with indirectbr instructions at all and therefore won't create dedicated exit blocks nor pre-headers in their presence. Haven't check yet but it's likey a similar crash will happen for loads when indirectbr is involved since there won't be a preheader to hoist out.

Thanks for the review!

bruno closed this revision.Nov 28 2014, 11:58 AM

Commited in r 222927