[PATCH] D46278: [AArch64] Fold B = csel A, A into B = COPY A

Francis Visoiu Mistrih via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 30 11:28:44 PDT 2018


thegameg created this revision.
thegameg added reviewers: t.p.northover, aemerson, eli.friedman, gberry.
Herald added subscribers: jkorous, kristof.beyls, rengolin.
Herald added a reviewer: javed.absar.

I found the following pattern in the LLVM test suite + SPEC 93 times:

  csel B, A, A

I see that in some places after MachineCSE runs, we end up with things like:

  %5:gpr32 = CSELWr %1, %1, 12, implicit $nzcv

In this case, a COPY would be much better.

I added support for `optimizeSelect` in `AArch64InstrInfo`, which is called by the `PeepholeOptimizer`.


https://reviews.llvm.org/D46278

Files:
  lib/Target/AArch64/AArch64InstrFormats.td
  lib/Target/AArch64/AArch64InstrInfo.cpp
  lib/Target/AArch64/AArch64InstrInfo.h
  test/CodeGen/AArch64/csel-same-source.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46278.144602.patch
Type: text/x-patch
Size: 5790 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180430/3790f25c/attachment.bin>


More information about the llvm-commits mailing list