[all-commits] [llvm/llvm-project] a52e78: [GlobalISel] Combine (xor (and x, y), y) -> (and (...

Jessica Paquette via All-commits all-commits at lists.llvm.org
Mon Sep 28 10:08:38 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: a52e78012a548c231fb8cba81861f6ffb2246726
      https://github.com/llvm/llvm-project/commit/a52e78012a548c231fb8cba81861f6ffb2246726
  Author: Jessica Paquette <jpaquette at apple.com>
  Date:   2020-09-28 (Mon, 28 Sep 2020)

  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
    M llvm/lib/Target/AArch64/AArch64Combine.td
    A llvm/test/CodeGen/AArch64/GlobalISel/prelegalizercombiner-xor-of-and-with-same-reg.mir

  Log Message:
  -----------
  [GlobalISel] Combine (xor (and x, y), y) -> (and (not x), y)

When we see this:

```
%and = G_AND %x, %y
%xor = G_XOR %and, %y
```

Produce this:

```
%not = G_XOR %x, -1
%new_and = G_AND %not, %y
```

as long as we are guaranteed to eliminate the original G_AND.

Also matches all commuted forms. E.g.

```
%and = G_AND %y, %x
%xor = G_XOR %y, %and
```

will be matched as well.

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




More information about the All-commits mailing list