[AArch64][GlobalISel] Move dup optimization into post-legalizer combiner
authorJessica Paquette <jpaquette@apple.com>
Fri, 5 Jun 2020 00:08:36 +0000 (17:08 -0700)
committerJessica Paquette <jpaquette@apple.com>
Sat, 6 Jun 2020 00:46:28 +0000 (17:46 -0700)
commit8f262a686e5ecd25552d6992bbccb08a8f5c3f26
tree46c9137b447d0dcf4ba92b4c6509fcaaccbf9ea2
parent7d59f49bdaddf053d74de9ef57c7ec64bdf4fa25
[AArch64][GlobalISel] Move dup optimization into post-legalizer combiner

Since all of the other G_SHUFFLE_VECTOR transforms are going there, let's do
this with dup as well. This is nice, because it lets us split up the original
code into matching, register bank selection, and instruction selection.

- Create G_DUP, make it equivalent to AArch64dup

- Add a post-legalizer combine which is 90% a copy-and-paste from
  tryOptVectorDup, except with shuffle matching closer to what SelectionDAG
  does in `ShuffleVectorSDNode::isSplatMask`.

- Teach RegBankSelect about G_DUP. Since dup selection relies on the correct
  register bank for FP/GPR dup selection, this is necessary.

- Kill `tryOptVectorDup`, since it's now entirely handled by G_DUP.

- Add testcases for the combine, RegBankSelect, and selection. The selection
  test gives the same selection results as the old test.

Differential Revision: https://reviews.llvm.org/D81221
llvm/lib/Target/AArch64/AArch64Combine.td
llvm/lib/Target/AArch64/AArch64InstrGISel.td
llvm/lib/Target/AArch64/AArch64RegisterBankInfo.cpp
llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp
llvm/lib/Target/AArch64/GISel/AArch64PostLegalizerCombiner.cpp
llvm/test/CodeGen/AArch64/GlobalISel/postlegalizer-combiner-shuffle-splat.mir [new file with mode: 0644]
llvm/test/CodeGen/AArch64/GlobalISel/regbank-dup.mir [new file with mode: 0644]
llvm/test/CodeGen/AArch64/GlobalISel/select-dup.mir [moved from llvm/test/CodeGen/AArch64/GlobalISel/opt-shuffle-splat.mir with 56% similarity]