[llvm] [InstCombine] Generalize zext(add X, -C) + C folding (PR #191723)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 13 08:05:42 PDT 2026
================
@@ -4535,3 +4535,18 @@ define <2 x i32> @ceil_div_vec_multi_use(<2 x i32> range(i32 0, 1000) %x) {
declare void @use_i32(i32)
declare void @use_vec(<2 x i32>)
declare void @fake_func(i32)
+; Fold (add (zext (add X, -C)), C) -> (zext X) if X u>= C.
----------------
Maiowaa wrote:
Thanks for the suggestion!
I've added negative tests for:
- the case where C doesn't fit in the inner type (e.g., C=260)
- the mismatch case where outer C and inner -C don't correspond
Let me know if you'd like any further adjustments.
https://github.com/llvm/llvm-project/pull/191723
More information about the llvm-commits
mailing list