This is an archive of the discontinued LLVM Phabricator instance.

[LVI][CVP] LazyValueInfoImpl::solveBlockValueBinaryOp(): use no-wrap flags from `add` op
ClosedPublic

Authored by lebedev.ri on Oct 22 2019, 1:19 PM.

Details

Summary

This was suggested in https://reviews.llvm.org/D69277#1717210
In this form (this is what was suggested, right?), the results aren't staggering
(especially since given LVI cross-block focus)
this catch some things (as per test-suite), but not too much:

statisticoldnewdelta% change
correlated-value-propagation.NumAddNSW4981498210.0201%
correlated-value-propagation.NumAddNW121251212610.0082%
correlated-value-propagation.NumCmps1199120230.2502%
correlated-value-propagation.NumDeadCases112111-1-0.8929%
correlated-value-propagation.NumMulNSW27527831.0909%
correlated-value-propagation.NumMulNUW1323132630.2268%
correlated-value-propagation.NumMulNW1598160460.3755%
correlated-value-propagation.NumNSW7158716790.1257%
correlated-value-propagation.NumNUW133041331060.0451%
correlated-value-propagation.NumNW2046220477150.0733%
correlated-value-propagation.NumOverflows47375.0000%
correlated-value-propagation.NumPhis1536615381150.0976%
correlated-value-propagation.NumSExt6273627740.0638%
correlated-value-propagation.NumShlNSW11721171-1-0.0853%
correlated-value-propagation.NumShlNUW2793279410.0358%
correlated-value-propagation.NumSubNSW73073660.8219%
correlated-value-propagation.NumSubNUW2044204620.0978%
correlated-value-propagation.NumSubNW2774278280.2884%
instcount.NumAddInst277586277569-17-0.0061%
instcount.NumAndInst6605666054-2-0.0030%
instcount.NumBrInst709147709146-1-0.0001%
instcount.NumCallInst528579528576-3-0.0006%
instcount.NumExtractValueInst1830718301-6-0.0328%
instcount.NumOrInst10266010266550.0049%
instcount.NumPHIInst318008318007-1-0.0003%
instcount.NumSelectInst4637346370-3-0.0065%
instcount.NumSExtInst7949679488-8-0.0101%
instcount.NumShlInst406544065730.0074%
instcount.NumTruncInst6225162249-2-0.0032%
instcount.NumZExtInst6821168221100.0147%
instcount.TotalBlocks843910843909-1-0.0001%
instcount.TotalInsts73874487387423-25-0.0003%

Diff Detail

Event Timeline

lebedev.ri created this revision.Oct 22 2019, 1:19 PM
nikic accepted this revision.Oct 23 2019, 1:03 AM

LGTM

Thanks for looking into this! I think we should definitely do this change as the functionality already exists, but based on the numbers, it probably doesn't make sense to invest in NoWrap implementations of other operators unless we also need them for something else (SCEV was the original motivation here).

llvm/include/llvm/IR/ConstantRange.h
330

nit: an left hand side -> a left hand side

335

I'd swap the last two arguments here to match the order of makeGuaranteedNoWrapRegion and addWithNoWrap, which both have NoWrapFlags after the range.

This revision is now accepted and ready to land.Oct 23 2019, 1:03 AM
lebedev.ri marked 2 inline comments as done.Oct 23 2019, 8:01 AM

LGTM

Thanks for looking into this!

Thank you for the review.

I think we should definitely do this change as the functionality already exists, but based on the numbers,
it probably doesn't make sense to invest in NoWrap implementations of other operators
unless we also need them for something else (SCEV was the original motivation here).

It's indeed hard to say whether handling of other three OBO will be worth it,
without actually implementing everything and measuring..

This revision was automatically updated to reflect the committed changes.