This is an archive of the discontinued LLVM Phabricator instance.

[SCEV] ScalarEvolution::createSCEV(): clarify no-wrap flag propagation for shift by bitwidth-1
ClosedPublic

Authored by lebedev.ri on Jun 5 2020, 1:58 AM.

Details

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.

Diff Detail

Event Timeline

lebedev.ri created this revision.Jun 5 2020, 1:58 AM
efriedma accepted this revision.Jun 5 2020, 5:55 PM

LGTM

This revision is now accepted and ready to land.Jun 5 2020, 5:55 PM

LGTM

Thank you for the review.

This revision was automatically updated to reflect the committed changes.