[llvm] [InstCombine] Div ceil optimizations (PR #190175)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 5 12:21:38 PDT 2026


================
@@ -1523,6 +1523,68 @@ static Instruction *foldBoxMultiply(BinaryOperator &I) {
   return nullptr;
 }
 
+// Return true if X + (Y-1) is provably non-wrapping in X's type
+static bool checkDivCeilNUW(Value *X, Value *Y, BinaryOperator &I,
----------------
dtcxzyw wrote:

The constraint can be relaxed to `X + Y` doesn't unsigned wrap: https://alive2.llvm.org/ce/z/szx6SF. Does `InstCombinerImpl::willNotOverflowUnsignedAdd` meets your demand?

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


More information about the llvm-commits mailing list