[PATCH] SCEVExpander incorrectly marks increment operations as no-wrap

Sanjoy Das sanjoy at playingwithpointers.com
Wed Feb 25 23:19:40 PST 2015


> SCEVExpander could have a mode that attempts to preserve flags, and a mode where it just always generates the sub. Or you can try to generate the sub whenever it doesn't lose the flags. However, I vote for keeping it simple and just always generating the add and letting InstCombine cleanup if it actually matters.

I agree -- I'll put up a patch for review shortly.

> Incidentally, are you more often relying on nsw/nuw to be inferred within SCEV, or are you relying more on your frontend to generate them in special situations?

All Java-level integer arithmetic gets lowered into
potentially-wrapping operations, and it is up to scalar evolution to
prove when overflow does not happen.

Slight tangent:  I noticed is that LFTR will not happen for a loop
with multiple exiting blocks.  Most of the interesting loops we
generate have multiple exiting blocks due to range checks and null
checks, so this may yet be another area where we end up missing some
optimizations because of non-canonical IR.

>
>
> REPOSITORY
>   rL LLVM
>
> http://reviews.llvm.org/D7778
>
> EMAIL PREFERENCES
>   http://reviews.llvm.org/settings/panel/emailpreferences/
>
>




More information about the llvm-commits mailing list