[llvm] [RISCV][backend] port `(not (add X, -1)) -> (neg X)` to GlobalISel (PR #181640)

Luisa Cicolini via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 16 04:17:28 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)) -> (neg X)
----------------
luisacicolini wrote:

```suggestion
// fold (not (add X, -1)) -> (sub 0, X)
```

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


More information about the llvm-commits mailing list