[PATCH] D154565: [InstCombine] Fold icmps comparing uadd_sat with a constant
Dhruv Chawla via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 6 10:05:14 PDT 2023
0xdc03 marked an inline comment as done.
0xdc03 added inline comments.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:3651
+ ConstantRange C1 = ConstantRange::makeExactICmpRegion(
+ LHSPred, IntrinsicIsUAddSat ? ~*COp1 : *COp1);
ConstantRange C2 = ConstantRange::makeExactICmpRegion(Pred, C);
----------------
nikic wrote:
> In the end, what we're computing here is the range of values where the add/sub doesn't (or does) overflow. Can we express this in terms of makeExactNoWrapRegion() instead? That would also make it easier to extend this to signed intrinsics in the future, where the overflow condition is more complex.
Yup, this works quite well 😄
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D154565/new/
https://reviews.llvm.org/D154565
More information about the llvm-commits
mailing list