[llvm] [GlobalISel] port rewrite from SelectionDAG to GlobalISel (PR #181486)
Luisa Cicolini via llvm-commits
llvm-commits at lists.llvm.org
Sat Feb 14 09:32:13 PST 2026
================
@@ -1879,6 +1879,26 @@ def APlusBMinusCMinusB : GICombineRule<
(G_SUB $root, $add1, $B)),
(apply (G_SUB $root, $A, $C))>;
+// fold ((A+(B+C))-B) -> A+C
+def APlusBPlusCMinusB_frags : GICombinePatFrag<
+ (outs root:$root), (ins $x, $y, $n),
+ [
+ (pattern (G_ADD $add1, $y, $n),
+ (G_ADD $add2, $x, $add1),
+ (G_SUB $root, $add2, $y),
+ [{ return MRI.hasOneNonDBGUse(${add2}.getReg()) &&
+ MRI.hasOneNonDBGUse(${add1}.getReg()); }]),
+ ]>;
+
----------------
luisacicolini wrote:
```suggestion
```
https://github.com/llvm/llvm-project/pull/181486
More information about the llvm-commits
mailing list