[llvm] [InstCombine] Implement folds of icmp of UCMP/SCMP call and a constant (PR #96118)
Dhruv Chawla via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 19 19:18:07 PDT 2024
================
@@ -3926,6 +3926,92 @@ foldICmpUSubSatOrUAddSatWithConstant(ICmpInst::Predicate Pred,
ConstantInt::get(Op1->getType(), EquivInt));
}
+static Instruction *
+foldICmpOfCmpIntrinsicWithConstant(ICmpInst::Predicate Pred, IntrinsicInst *I,
+ const APInt &C,
+ InstCombiner::BuilderTy &Builder) {
+ Intrinsic::ID IID = I->getIntrinsicID();
+ Value *LHS = I->getOperand(0);
+ Value *RHS = I->getOperand(1);
+
+ switch (Pred) {
----------------
dc03-work wrote:
This switch seems quite verbose, I feel that these cases can be merged because their bodies are basically identical and only the icmp opcodes differ:
- `ICMP_EQ` with `ICMP_NE`
- `ICMP_SGT` with `ICMP_SLE`
- `ICMP_SGE` with `ICMP_SLT`
https://github.com/llvm/llvm-project/pull/96118
More information about the llvm-commits
mailing list