This is an archive of the discontinued LLVM Phabricator instance.

[IRCE] Fix SCEVExpander's usage in IRCE
ClosedPublic

Authored by mkazantsev on Oct 24 2017, 5:06 AM.

Details

Summary

When expanding exit conditions for pre- and postloops, we may end up expanding a
recurrency from the loop to in its loop's preheader. This produces incorrect IR.

This patch ensures that IRCE uses SCEVExpander correctly and only expands code which
is safe to expand in this particular location.

Diff Detail

Event Timeline

mkazantsev planned changes to this revision.Oct 25 2017, 12:30 AM

Planning to add some more tests.

Fixed typos in debug output message, added more tests for division.

reames accepted this revision.Nov 7 2017, 4:05 PM

LGTM once dependent changes land.

This revision is now accepted and ready to land.Nov 7 2017, 4:05 PM