[all-commits] [llvm/llvm-project] 5c26be: [AArch64][GlobalISel] Lower G_BUILD_VECTOR -> G_DUP

Jessica Paquette via All-commits all-commits at lists.llvm.org
Mon Mar 8 13:01:56 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5c26be214d9fd9bd544aab42f51898b447524edc
      https://github.com/llvm/llvm-project/commit/5c26be214d9fd9bd544aab42f51898b447524edc
  Author: Jessica Paquette <jpaquette at apple.com>
  Date:   2021-03-08 (Mon, 08 Mar 2021)

  Changed paths:
    M llvm/include/llvm/CodeGen/GlobalISel/Utils.h
    M llvm/lib/CodeGen/GlobalISel/Utils.cpp
    M llvm/lib/Target/AArch64/AArch64Combine.td
    M llvm/lib/Target/AArch64/CMakeLists.txt
    A llvm/lib/Target/AArch64/GISel/AArch64GlobalISelUtils.cpp
    M llvm/lib/Target/AArch64/GISel/AArch64GlobalISelUtils.h
    M llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp
    M llvm/lib/Target/AArch64/GISel/AArch64PostLegalizerLowering.cpp
    A llvm/test/CodeGen/AArch64/GlobalISel/postlegalizer-lowering-build-vector-to-dup.mir
    M llvm/test/CodeGen/AArch64/GlobalISel/postlegalizer-lowering-vashr-vlshr.mir
    M llvm/test/CodeGen/AArch64/GlobalISel/select-dup.mir
    M llvm/test/CodeGen/AArch64/GlobalISel/select-vector-shift.mir

  Log Message:
  -----------
  [AArch64][GlobalISel] Lower G_BUILD_VECTOR -> G_DUP

If we have

```
%vec = G_BUILD_VECTOR %reg, %reg, ..., %reg
```

Then lower it to

```
%vec = G_DUP %reg
```

Also update the selector to handle constant splats on G_DUP.

This will not combine when the splat is all zeros or ones. Tablegen-imported
patterns rely on these being G_BUILD_VECTOR.

Minor code size improvements on CTMark at -Os.

Also adds some utility functions to make it a bit easier to recognize splats,
and an AArch64-specific splat helper.

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




More information about the All-commits mailing list