[all-commits] [llvm/llvm-project] 45b9c6: [GlobalISel] Add commutative matchers for compares.

Jessica Paquette via All-commits all-commits at lists.llvm.org
Fri Oct 7 20:08:20 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 45b9c6b01f263d087a456b098b36e9ee90c607b2
      https://github.com/llvm/llvm-project/commit/45b9c6b01f263d087a456b098b36e9ee90c607b2
  Author: Jessica Paquette <jpaquette at apple.com>
  Date:   2022-10-07 (Fri, 07 Oct 2022)

  Changed paths:
    M llvm/include/llvm/CodeGen/GlobalISel/MIPatternMatch.h
    M llvm/unittests/CodeGen/GlobalISel/PatternMatchTest.cpp

  Log Message:
  -----------
  [GlobalISel] Add commutative matchers for compares.

This adds:

* `m_c_GICmp`
* `m_c_GFCmp`

These work the same way as the standard matchers, but will also try to commute
the LHS and RHS of a compare to get a match.

E.g.

```
m_c_GICmp(m_Pred(...), m_GAdd(...), m_GSub(...))
```

Can match either of

```
icmp cc (add x, y), (sub a, b)
icmp swapped_cc (sub a, b), (add x, y)
```

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




More information about the All-commits mailing list