[PATCH] D30446: [IndVars] Do not branch on poison

Andrew Trick via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 15 15:43:36 PDT 2017


atrick added a comment.

> I see this transform as a "canonicalization" type transform (supposed to make later loop opts easier), but I did not add it.  Maybe @atrick can shed some light here on the initial motivation?  I'm most certainly in favor of deleting code where possible.

I don't know of any good reason to run linearFunctionTestReplace during IndVarSimplify. I think it should be part of LSR's OptimizeLoopTermCond(), which is the only thing that depends on it now AFAIK. I suppose it's possible that some loop vectorizer code relies on LFTR.

If SCEV provides the same information before and after LFTR, then it doesn't seem like a useful canonicalization.

Replacing a quadratic loop test (i*i < N) with a linear loop test does seem like a useful simplification, but I suspect it's exceedingly rare.

I'm not sure how moving it to LSR would help you deal with poison on the backedge though. If you completely remove LFTR then

- We lose the quadratic to linear optimization (the original meaning of LFTR)
- I think LSR will fail to generate certain expected patterns like counting down to zero


https://reviews.llvm.org/D30446





More information about the llvm-commits mailing list