This is an archive of the discontinued LLVM Phabricator instance.

[LICM] Hoist assumes out of loops
ClosedPublic

Authored by reames on Aug 6 2018, 3:14 PM.

Details

Summary

If we have an assume which is known to execute and whose operand is invariant, we can lift that into the pre-header. So long as we don't change which paths the assume executes on, this is a legal transformation. It's likely to be a useful canonicalization as other transforms only look for dominating assumes.

Diff Detail

Repository
rL LLVM

Event Timeline

reames created this revision.Aug 6 2018, 3:14 PM
mkazantsev added inline comments.Aug 6 2018, 6:57 PM
test/Transforms/LICM/assume.ll
36 ↗(On Diff #159406)

Could you please add another test where assume uses a Phi or another unhoistable value from the loop, and therefore cannot be hoisted?

reames updated this revision to Diff 159549.Aug 7 2018, 10:57 AM

Rebased on top of newly submitted tests to address review comment

reames marked an inline comment as done.Aug 7 2018, 10:57 AM
This revision is now accepted and ready to land.Aug 9 2018, 9:01 PM
This revision was automatically updated to reflect the committed changes.