[llvm] Simplify `(a % b) lt/ge (b-1)` into `(a % b) eq/ne (b-1)` (PR #72504)

via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 12 13:59:35 PST 2024


================
@@ -6855,6 +6855,45 @@ Instruction *InstCombinerImpl::visitICmpInst(ICmpInst &I) {
   if (Value *V = simplifyICmpInst(I.getPredicate(), Op0, Op1, Q))
     return replaceInstUsesWith(I, V);
 
+  {
----------------
elhewaty wrote:

@nikic If it's inside `foldIcmpSRemConstant()` the `urem` optimizations won't work.
should I move the `srem` handling, and leave `urem` as it is? 

https://github.com/llvm/llvm-project/pull/72504


More information about the llvm-commits mailing list