diff options
author | Dhruv Chawla <44582521+dc03@users.noreply.github.com> | 2023-07-06 09:26:21 +0530 |
---|---|---|
committer | Dhruv Chawla <44582521+dc03@users.noreply.github.com> | 2023-07-08 12:50:39 +0530 |
commit | 23f0f061c399a51b9c846a7aaab1c15ce039e1a3 (patch) | |
tree | 3df3e210f7598653cbef9983fbeba11e69a1862f /llvm/lib/Transforms/Utils/ModuleUtils.cpp | |
parent | ed910840906b480fc1cab36b3e73021956dce511 (diff) | |
download | llvm-23f0f061c399a51b9c846a7aaab1c15ce039e1a3.zip llvm-23f0f061c399a51b9c846a7aaab1c15ce039e1a3.tar.gz llvm-23f0f061c399a51b9c846a7aaab1c15ce039e1a3.tar.bz2 |
[InstCombine] Fold icmps comparing uadd_sat with a constant
This patch is a continuation of D154206. It introduces a fold for the
operation "uadd_sat(X, C) pred C2" where "C" and "C2" are constants. The
fold is:
uadd_sat(X, C) pred C2
=> (X >= ~C) || ((X + C) pred C2) -> when (UINT_MAX pred C2) is true
=> (X < ~C) && ((X + C) pred C2) -> when (UINT_MAX pred C2) is false
This patch also generalizes the fold to work with any saturating
intrinsic as long as the saturating value is known.
Proofs: https://alive2.llvm.org/ce/z/wWeirP
Differential Revision: https://reviews.llvm.org/D154565
Diffstat (limited to 'llvm/lib/Transforms/Utils/ModuleUtils.cpp')
0 files changed, 0 insertions, 0 deletions