[all-commits] [llvm/llvm-project] 970cb9: [GlobalISel] Combine `(x + y) - y -> x` and friends

Jessica Paquette via All-commits all-commits at lists.llvm.org
Mon Oct 3 10:16:21 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 970cb99e0a8c9cd73e2aa43bdd33585d606dfb88
      https://github.com/llvm/llvm-project/commit/970cb99e0a8c9cd73e2aa43bdd33585d606dfb88
  Author: Jessica Paquette <jpaquette at apple.com>
  Date:   2022-10-03 (Mon, 03 Oct 2022)

  Changed paths:
    M llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h
    M llvm/include/llvm/Target/GlobalISel/Combine.td
    M llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
    A llvm/test/CodeGen/AArch64/GlobalISel/combine-add-of-sub.mir

  Log Message:
  -----------
  [GlobalISel] Combine `(x + y) - y -> x` and friends

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.

Differential Revision: https://reviews.llvm.org/D135010




More information about the All-commits mailing list