Page MenuHomePhabricator

[ConstantRange] Fix the early out in ConstantRange::multiply for positive numbers to really do what the comment says

Authored by craig.topper on May 10 2017, 12:10 PM.



r271020 added an early out to skip the signed multiply portion of ConstantRange::multiply. The comment says we don't need to do signed multiply if the range is only positive numbers, but the implemented check only ensures that the start of the range is positive. It doesn't look at the end of the range.

This patch checks the end of the range instead. Because Upper is one more than the end we have to see if its positive or if its one past the last positive number.

Diff Detail

Event Timeline

craig.topper created this revision.May 10 2017, 12:10 PM
pete accepted this revision.May 10 2017, 12:25 PM

Good catch! LGTM.

This revision is now accepted and ready to land.May 10 2017, 12:25 PM

Committed in r302717, but forgot to include the Differential Revision line