Recommit "[SCCP] Use range info to prove AddInst has NUW flag."
This reverts commit 531756b9. 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 5b16cd97. 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. 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
Loading
Please sign in to comment