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
Diff Detail
Event Timeline
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). |
Comment Actions
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.) |
Comment Actions
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).
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.)