[PATCH] Bugfix: SCEV incorrectly marks certain add recurrences as nsw

Sanjoy Das sanjoy at playingwithpointers.com
Sun Feb 8 23:07:28 PST 2015


In http://reviews.llvm.org/D7495#120452, @atrick wrote:

> Great catch and test case!
>
> It's not clear to me why the isKnownNonZero check is necessary. Otherwise LGTM.


I thought if `X` is `0` in `{S,+,X}` then it would "wrap" on every iteration.  But `ScalarEvolution.h` says no-wrap means `abs(step) * max-iteration(loop) <= unsigned-max(bitwidth).`  So this means we cannot assume that a `<nw>` add-rec will never reach its starting value, right (since step = 0 satisfies the inequality)?


http://reviews.llvm.org/D7495

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list