[llvm] [InstCombine] Fold umax(nuw_mul(x, C0), x + 1) into (x == 0 ? 1 : nuw_mul(x, C0)) (PR #123468)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 18 09:06:00 PST 2025


================
@@ -1847,6 +1847,37 @@ Instruction *InstCombinerImpl::visitCallInst(CallInst &CI) {
         return CastInst::Create(Instruction::ZExt, NarrowMaxMin, II->getType());
       }
     }
+    // If C0 is not 0:
----------------
nikic wrote:

Note that there is a fallthrough from umin above. Please add a negative test for umin.

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


More information about the llvm-commits mailing list