This is an archive of the discontinued LLVM Phabricator instance.

[SCEV] Make getUDivExactExpr handle non-nuw multiplies correctly
ClosedPublic

Authored by efriedma on Jan 11 2017, 4:34 PM.

Details

Summary

To avoid regressions, make ScalarEvolution::createSCEV a bit more clever.

Also get rid of some useless code in ScalarEvolution::howFarToZero which was hiding this bug.

No new testcase because it's impossible to actually expose this bug: we don't have any in-tree users of getUDivExactExpr besides the two functions I just mentioned, and they both dodged the problem.

Diff Detail

Repository
rL LLVM

Event Timeline

efriedma updated this revision to Diff 84052.Jan 11 2017, 4:34 PM
efriedma retitled this revision from to [SCEV] Make getUDivExactExpr handle non-nuw multiplies correctly.
efriedma updated this object.
efriedma added a reviewer: sanjoy.
efriedma set the repository for this revision to rL LLVM.
efriedma added a subscriber: llvm-commits.
efriedma updated this revision to Diff 84055.Jan 11 2017, 4:56 PM
efriedma removed rL LLVM as the repository for this revision.

Uploaded wrong version of the patch.

sanjoy accepted this revision.Jan 14 2017, 6:26 PM
sanjoy edited edge metadata.

Can I ask you to please to (in a later commit) change createSCEV to use getUDivExactExpr for udiv exact instructions, and add some tests around what you're changing here?

lib/Analysis/ScalarEvolution.cpp
7248 ↗(On Diff #84055)

I think we can basically drop this whole comment.

This revision is now accepted and ready to land.Jan 14 2017, 6:26 PM
This revision was automatically updated to reflect the committed changes.