aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
diff options
context:
space:
mode:
authorFlorian Hahn <flo@fhahn.com>2023-01-25 18:07:24 +0000
committerFlorian Hahn <flo@fhahn.com>2023-01-25 18:07:25 +0000
commit366e1faa2fffd5b2284e25b09b6a26bcd2aca2b7 (patch)
treecb4907cd5816ce3089fd1417c9a0246306aec860 /llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
parent913837eaa3d14a5fb68179f8210dc097383a048c (diff)
downloadllvm-366e1faa2fffd5b2284e25b09b6a26bcd2aca2b7.zip
llvm-366e1faa2fffd5b2284e25b09b6a26bcd2aca2b7.tar.gz
llvm-366e1faa2fffd5b2284e25b09b6a26bcd2aca2b7.tar.bz2
Recommit "[SCCP] Use range info to prove AddInst has NUW flag."
The recommitted version fixes a crash when one of the operands is a constant other than a ConstantInt. Test for that case have been added in 5b16cd97b8e1c273. It splits off the new logic into a separate function because setting the flags is quite different compared to the other cases handled in replaceSignedInst which all require replacing an existing instruction. Instructions are now refined before any replacements are done, which has the advantage that we should have lattice values for all operands (fixing the crashes and simplifies the logic) and also allows optimizing more cases where one of the operands also gets replaced (see improvements in @sge_with_sext_to_zext_conversion). It also guards makeGuaranteedNoWrapRegion by `if (!Inst.hasNoUnsignedWrap())` as discussed in the review. Fixes #60280. Fixes #60278. Original message: This patch updates SCCP to use the value ranges of AddInst operands to try to prove the AddInst does not overflow in the unsigned sense and adds the NUW flag. The reasoning is done with makeGuaranteedNoWrapRegion (thanks @nikic for point it out!). Follow-ups will include adding NSW and extension to more OverflowingBinaryOperators. Reviewed By: nikic Differential Revision: https://reviews.llvm.org/D142387
Diffstat (limited to 'llvm/lib/ProfileData/Coverage/CoverageMapping.cpp')
0 files changed, 0 insertions, 0 deletions