[llvm] [InstCombine]: Eliminate redundant modulus for urem (PR #157644)

via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 9 06:15:11 PDT 2025


================
@@ -2473,6 +2473,14 @@ Instruction *InstCombinerImpl::visitURem(BinaryOperator &I) {
     }
   }
 
+  Value *A;
+  Value *B;
+  // urem(urem(A, B), Op1) -> urem(A, Op1)
+  if (match(Op0, m_URem(m_Value(A), m_Value(B)))) {
----------------
kper wrote:

oohh I was missing the check
Thank you!

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


More information about the llvm-commits mailing list