[llvm] [InstCombine] Div ceil optimizations (PR #190175)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Sat Apr 11 07:07:14 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 original constraint is better. I mean, we can relax the check to leverage existing helpers.
> I would also prefer the helper, how would I say X + Y - 1 doesn't overflow unsigned with willNotOverflowUnsignedAdd?
It is impossible since `Y - 1` is not an existing expression.
https://github.com/llvm/llvm-project/pull/190175
More information about the llvm-commits
mailing list