This is an archive of the discontinued LLVM Phabricator instance.

[SCEV] Simplify SolveLinEquationWithOverflow a bit.
ClosedPublic

Authored by efriedma on Jan 11 2017, 3:06 PM.

Details

Reviewers
sanjoy
Summary

Cleanup in preparation for generalizing it.

Diff Detail

Repository
rL LLVM

Event Timeline

efriedma updated this revision to Diff 84032.Jan 11 2017, 3:06 PM
efriedma retitled this revision from to [SCEV] Simplify SolveLinEquationWithOverflow a bit..
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.
sanjoy accepted this revision.Jan 11 2017, 3:54 PM
sanjoy edited edge metadata.

Your change looks correct to me, but I don't know why we chose to express N/D as a BW+1 bit integer in the first place.

lib/Analysis/ScalarEvolution.cpp
7035

I don't understand why "(N / D) may need BW+1 bits in its representation" is true, btw. It seems to me N/D should always fit in BW bits.

7040

Add an assert here?

This revision is now accepted and ready to land.Jan 11 2017, 3:54 PM
efriedma added inline comments.Jan 11 2017, 4:55 PM
lib/Analysis/ScalarEvolution.cpp
7035

Suppose D is 1. Then N/D == N == 2^BW; the largest possible value for a BW-bit integer is 2^BW-1.

7040

Sure.