This adds a combine that handles
(x + y) - y -> x (x + y) - x -> y x - (y + x) -> 0 - y x - (x + z) -> 0 - z
On AArch64, we get added benefit for 0 - y because it can be selected to a neg instruction.
Paths
| Differential D135010
[GlobalISel] Combine `(x + y) - y -> x` and friends ClosedPublic Authored by paquette on Sep 30 2022, 9:55 PM.
Details Summary This adds a combine that handles (x + y) - y -> x (x + y) - x -> y x - (y + x) -> 0 - y x - (x + z) -> 0 - z On AArch64, we get added benefit for 0 - y because it can be selected to a neg instruction.
Diff Detail
Event Timeline
This revision is now accepted and ready to land.Oct 1 2022, 1:55 PM This revision was landed with ongoing or failed builds.Oct 3 2022, 10:16 AM Closed by commit rG970cb99e0a8c: [GlobalISel] Combine `(x + y) - y -> x` and friends (authored by paquette). · Explain Why This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 464725 llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h
llvm/include/llvm/Target/GlobalISel/Combine.td
llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
llvm/test/CodeGen/AArch64/GlobalISel/combine-add-of-sub.mir
|
Should also add vector cases