This is an archive of the discontinued LLVM Phabricator instance.

[SCEV] Handle uge/ugt predicates in applyLoopGuards()
ClosedPublic

Authored by nikic on Apr 23 2021, 1:12 PM.

Details

Summary

These can be handled the same way as ule/ult, just using umax instead of umin. This is useful in cases where the umax prevents the upper bound from overflowing.

Diff Detail

Unit TestsFailed

Event Timeline

nikic created this revision.Apr 23 2021, 1:12 PM
nikic requested review of this revision.Apr 23 2021, 1:12 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 23 2021, 1:12 PM
nikic updated this revision to Diff 340308.Apr 24 2021, 12:49 PM

Rebase over some implementation cleanup.

fhahn accepted this revision.Apr 27 2021, 3:33 AM

LGTM, thanks!

Would it be possible to have a test which requires multiple re-writes, by limiting the IV in both directions?

llvm/test/Analysis/ScalarEvolution/max-backedge-taken-count-guard-info.ll
636

IMO it would slightly increase the readability of the test here if we would use the uge predicate, as in the test name :)

This revision is now accepted and ready to land.Apr 27 2021, 3:33 AM
nikic updated this revision to Diff 340971.Apr 27 2021, 1:37 PM

Rebase over added/improved tests.

nikic marked an inline comment as done.Apr 27 2021, 1:40 PM
nikic added inline comments.
llvm/test/Analysis/ScalarEvolution/max-backedge-taken-count-guard-info.ll
636

Yeah, that makes a lot more sense :) I just picked picked the order from the original test case...

This revision was landed with ongoing or failed builds.Apr 27 2021, 1:41 PM
This revision was automatically updated to reflect the committed changes.
nikic marked an inline comment as done.