[PATCH] D88104: [GlobalISel] Combine (xor (and x, y), y) -> (and (not x), y)

Jessica Paquette via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 22 09:30:29 PDT 2020


paquette created this revision.
paquette added reviewers: aemerson, mkitzan, arsenm.
Herald added subscribers: hiraditya, rovka.
Herald added a project: LLVM.
paquette requested review of this revision.
Herald added a subscriber: wdng.

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.


https://reviews.llvm.org/D88104

Files:
  llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h
  llvm/include/llvm/Target/GlobalISel/Combine.td
  llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
  llvm/lib/Target/AArch64/AArch64Combine.td
  llvm/test/CodeGen/AArch64/GlobalISel/prelegalizercombiner-xor-of-and-with-same-reg.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88104.293492.patch
Type: text/x-patch
Size: 10215 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200922/c6a4a51b/attachment.bin>


More information about the llvm-commits mailing list