Page MenuHomePhabricator

[CVP] No-wrap deduction for `shl`
ClosedPublic

Authored by lebedev.ri on Mon, Oct 21, 12:41 PM.

Details

Summary

This is the last OverflowingBinaryOperator for which we don't deduce flags.
D69217 taught ConstantRange::makeGuaranteedNoWrapRegion() about it.

The effect is better than of the mul patch (D69203):

statisticoldnewdelta% change
correlated-value-propagation.NumAddNUW71457144-1-0.0140%
correlated-value-propagation.NumAddNW1212612125-1-0.0082%
correlated-value-propagation.NumAnd44344630.6772%
correlated-value-propagation.NumNSW59867158117219.5790%
correlated-value-propagation.NumNUW1051213304279226.5601%
correlated-value-propagation.NumNW1649820462396424.0272%
correlated-value-propagation.NumShlNSW011721172
correlated-value-propagation.NumShlNUW027932793
correlated-value-propagation.NumShlNW039653965
instcount.NumAShrInst1382413790-34-0.2459%
instcount.NumAddInst27758427758620.0007%
instcount.NumAndInst6606166056-5-0.0076%
instcount.NumBrInst709153709147-6-0.0008%
instcount.NumICmpInst483709483708-1-0.0002%
instcount.NumSExtInst7949779496-1-0.0013%
instcount.NumShlInst4069140654-37-0.0909%
instcount.NumSubInst6199761996-1-0.0016%
instcount.NumZExtInst682086821130.0044%
instcount.TotalBlocks843916843910-6-0.0007%
instcount.TotalInsts73875287387448-80-0.0011%

Diff Detail

Event Timeline

lebedev.ri created this revision.Mon, Oct 21, 12:41 PM
nikic accepted this revision.Mon, Oct 21, 1:11 PM

LGTM. Small overall effect, but I think it still makes sense for completeness, and as far as I know this shouldn't be particularly expensive.

Can I interest you in making LVI use the recently added addWithNoWrap() method, to get some cross-pollination from nowrap flags inferred by other passes? Would be interesting to see if that allows us to infer/simplify more in CVP. If it does, we can invest some effort in adding this functionality for other operators as well.

This revision is now accepted and ready to land.Mon, Oct 21, 1:11 PM
This revision was automatically updated to reflect the committed changes.