[SCEV] ScalarEvolution::createSCEV(): clarify no-wrap flag propagation for shift...
authorRoman Lebedev <lebedev.ri@gmail.com>
Sat, 6 Jun 2020 09:59:44 +0000 (12:59 +0300)
committerRoman Lebedev <lebedev.ri@gmail.com>
Sat, 6 Jun 2020 10:02:07 +0000 (13:02 +0300)
commitc868335e243262876b0db3328f79153bd2d27d00
treebedd35d28c3262c65ab6ec7d6018261bcb4aeea9
parentff1210edb69ea6e073b9037ad3ecef399e11a1f9
[SCEV] ScalarEvolution::createSCEV(): clarify no-wrap flag propagation for shift by bitwidth-1

Summary:
There was this comment here previously:
```
-        // It is currently not resolved how to interpret NSW for left
-        // shift by BitWidth - 1, so we avoid applying flags in that
-        // case. Remove this check (or this comment) once the situation
-        // is resolved. See
-        // http://lists.llvm.org/pipermail/llvm-dev/2015-April/084195.html
-        // and http://reviews.llvm.org/D8890 .
```
But langref was fixed in rL286785, and the behavior is pretty obvious:
http://volta.cs.utah.edu:8080/z/MM4WZP
^ nuw can always be propagated. nsw can be propagated if
either nuw is specified, or the shift is by *less* than bitwidth-1.

This mimics similar D81189 Reassociate change, alive2 is happy about that one.

I'm not sure `NUW` isn't being printed, but that seems unrelated.

Reviewers: mkazantsev, reames, sanjoy, nlopes, craig.topper, efriedma

Reviewed By: efriedma

Subscribers: hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D81243
llvm/lib/Analysis/ScalarEvolution.cpp
llvm/test/Analysis/ScalarEvolution/flags-from-poison.ll