This is an archive of the discontinued LLVM Phabricator instance.

[LFTR] Don't use post-inc IV unless already used
AcceptedPublic

Authored by nikic on Jul 6 2019, 7:52 AM.

Details

Reviewers
reames
sanjoy
Summary

As discussed on D63686, this switches LFTR to not use the post-inc form, unless the existing IV already used a post-inc check. Converting to pre-inc to post-inc form is left to LSR.

Diff Detail

Event Timeline

nikic created this revision.Jul 6 2019, 7:52 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 6 2019, 7:52 AM
nikic marked an inline comment as done.Jul 6 2019, 7:57 AM
nikic added inline comments.
llvm/test/Transforms/IndVarSimplify/lftr.ll
390

This change can be avoided by strengthening the isLoopExitTestBasedOn() check to look for indirect uses (there's a truncate in between here).

reames accepted this revision.Jul 8 2019, 10:46 AM

LGTM

llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
2407

It occurs to me that checks other than the latch might already be in post-inc form. Maybe we should leave them that way? (Definitely a separate change.)

This revision is now accepted and ready to land.Jul 8 2019, 10:46 AM

Taking a look at LSR, I have the unfortunate suspicion that it also has the poison bug we fixed here for post-inc. I see nothing to strip flags (at all).

sanjoy resigned from this revision.Jan 29 2022, 5:40 PM