[PATCH] D154565: [InstCombine] Fold icmps comparing uadd_sat with a constant
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 7 13:16:25 PDT 2023
nikic accepted this revision.
nikic added a comment.
This revision is now accepted and ready to land.
LGTM
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:3643
+ // evaluates to true. For the LHS, this means the exact inverse of the range
+ // of values of the above.
+ ConstantRange C1 = ConstantRange::makeExactNoWrapRegion(
----------------
I feel like this comment is largely redundant with the one above...
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:3651
ConstantRange C2 = ConstantRange::makeExactICmpRegion(Pred, C);
- C2 = C2.add(*COp1);
+ if (IntrinsicIsAddition)
+ C2 = C2.sub(*COp1);
----------------
This variable is only used here -- check `II->getBinaryOp() == Instruction::Add` instead?
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