[llvm] Implement foldICmpRemConstant in InstCombineCompares (PR #77410)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 8 23:24:20 PST 2024
================
@@ -2572,6 +2572,46 @@ Instruction *InstCombinerImpl::foldICmpSRemConstant(ICmpInst &Cmp,
return new ICmpInst(ICmpInst::ICMP_UGT, And, ConstantInt::get(Ty, SignMask));
}
+Instruction *InstCombinerImpl::foldICmpRemConstant(ICmpInst &Cmp,
+ BinaryOperator *Rem,
+ const APInt &C) {
+ const ICmpInst::Predicate Pred = Cmp.getPredicate();
----------------
dtcxzyw wrote:
```suggestion
assert((Rem->getOpcode() == Instruction::SRem || Rem->getOpcode() == Instruction::URem) && "Only for srem/urem!");
const ICmpInst::Predicate Pred = Cmp.getPredicate();
```
https://github.com/llvm/llvm-project/pull/77410
More information about the llvm-commits
mailing list