This is an archive of the discontinued LLVM Phabricator instance.

[LoopPredication] Enable predication when latchCheckIV is wider than rangeCheck
ClosedPublic

Authored by anna on Nov 1 2017, 12:03 PM.

Details

Summary

This patch allows us to predicate range checks that have a type narrower than
the latch check type. We leverage SCEV analysis to identify a truncate for the
latchLimit and latchStart.
There is also safety checks in place which requires the start and limit to be
known at compile time. We require this to make sure that the SCEV truncate expr
for the IV corresponding to the latch does not cause us to lose information
about the IV range.
Added tests show the loop predication over range checks that are of various
types and are narrower than the latch type.
This enhancement has been in our downstream tree for a while.

Event Timeline

anna created this revision.Nov 1 2017, 12:03 PM
apilipenko accepted this revision.Nov 2 2017, 7:49 AM
apilipenko added inline comments.
lib/Transforms/Scalar/LoopPredication.cpp
380

Can you please add a comment why we can't compare with LatchCheck.IV->getStepRecurrence(*SE) anymore?

393

Maybe TyLatchCheck and TyLatchCheckOpt?

This revision is now accepted and ready to land.Nov 2 2017, 7:49 AM
This revision was automatically updated to reflect the committed changes.
anna marked an inline comment as done.Nov 2 2017, 2:26 PM
anna added inline comments.
lib/Transforms/Scalar/LoopPredication.cpp
393

I'll be refactoring the code out and will update the name with that NFC.