[llvm] [GIsel] import `(not (add X, -1)) -> (neg X)` to GlobalISel (PR #181640)
Luisa Cicolini via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 19 10:46:41 PST 2026
================
@@ -1946,6 +1946,13 @@ def APlusBMinusCPlusA : GICombineRule<
(G_SUB $sub1, $B, $add1),
(G_ADD $root, $A, $sub1)),
(apply (G_SUB $root, $B, $C))>;
+
+// fold (not (add X, -1)) -> (sub 0, X)
+def NotAPlusNegOne: GICombineRule<
+ (defs root:$root),
+ (match (G_ADD $add, $A, -1),
+ (G_XOR $root, $add, -1)),
----------------
luisacicolini wrote:
added
https://github.com/llvm/llvm-project/pull/181640
More information about the llvm-commits
mailing list