[all-commits] [llvm/llvm-project] cdeaf5: Recommit "[SCCP] Use range info to prove AddInst h...
Florian Hahn via All-commits
all-commits at lists.llvm.org
Thu Jan 26 03:45:39 PST 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: cdeaf5f28c3dca7fa313bdc5657cd07fb08dec5b
https://github.com/llvm/llvm-project/commit/cdeaf5f28c3dca7fa313bdc5657cd07fb08dec5b
Author: Florian Hahn <flo at fhahn.com>
Date: 2023-01-26 (Thu, 26 Jan 2023)
Changed paths:
M llvm/lib/Transforms/Utils/SCCPSolver.cpp
M llvm/test/Transforms/SCCP/add-nuw-nsw-flags.ll
M llvm/test/Transforms/SCCP/binaryops-constexprs.ll
M llvm/test/Transforms/SCCP/conditions-ranges-with-undef.ll
M llvm/test/Transforms/SCCP/conditions-ranges.ll
M llvm/test/Transforms/SCCP/ip-add-range-to-call.ll
M llvm/test/Transforms/SCCP/ip-constant-ranges.ll
M llvm/test/Transforms/SCCP/ip-ranges-binaryops.ll
M llvm/test/Transforms/SCCP/ip-ranges-casts.ll
M llvm/test/Transforms/SCCP/ip-ranges-phis.ll
M llvm/test/Transforms/SCCP/ip-ranges-select.ll
M llvm/test/Transforms/SCCP/return-argument.ll
M llvm/test/Transforms/SCCP/return-constants.ll
M llvm/test/Transforms/SCCP/widening.ll
Log Message:
-----------
Recommit "[SCCP] Use range info to prove AddInst has NUW flag."
This reverts commit 531756b9544b3e164b9ab998292fce3ebbc7c746.
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.
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
More information about the All-commits
mailing list