This is an archive of the discontinued LLVM Phabricator instance.

SCEVExpander incorrectly marks generated subtractions as nuw/nsw
ClosedPublic

Authored by sanjoy on Feb 26 2015, 2:12 AM.

Details

Summary

It is not sound to mark the increment operation as nuw or nsw
based on a proof off of the add recurrence if the increment operation
we emit happens to be a sub instruction.

I could not come up with a test case for this -- the cases where
SCEVExpander decides to emit a sub instruction is quite small, and I
cannot think of a way I'd be able to get SCEV to prove that the
increment does not overflow in those cases.

Diff Detail

Repository
rL LLVM

Event Timeline

sanjoy updated this revision to Diff 20735.Feb 26 2015, 2:12 AM
sanjoy retitled this revision from to SCEVExpander incorrectly marks generated subtractions as nuw/nsw.
sanjoy updated this object.
sanjoy edited the test plan for this revision. (Show Details)
sanjoy added a reviewer: atrick.
sanjoy added a subscriber: Unknown Object (MLST).
atrick accepted this revision.Feb 26 2015, 8:34 AM
atrick edited edge metadata.

LGTM

This revision is now accepted and ready to land.Feb 26 2015, 8:34 AM
This revision was automatically updated to reflect the committed changes.