[PATCH] D154565: [InstCombine] Fold icmps comparing uadd_sat with a constant
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 6 00:27:17 PDT 2023
nikic 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);
----------------
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.
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