[all-commits] [llvm/llvm-project] 2363a2: [AArch64][GlobalISel] Optimize G_BUILD_VECTOR of u...

Jessica Paquette via All-commits all-commits at lists.llvm.org
Thu Aug 26 11:45:42 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2363a2000171d12e21bc49a783291401656c4f35
      https://github.com/llvm/llvm-project/commit/2363a2000171d12e21bc49a783291401656c4f35
  Author: Jessica Paquette <jpaquette at apple.com>
  Date:   2021-08-26 (Thu, 26 Aug 2021)

  Changed paths:
    M llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp
    M llvm/test/CodeGen/AArch64/GlobalISel/select-build-vector.mir
    M llvm/test/CodeGen/AArch64/arm64-rev.ll

  Log Message:
  -----------
  [AArch64][GlobalISel] Optimize G_BUILD_VECTOR of undef + 1 elt -> SUBREG_TO_REG

This pattern

```
%elt = ... something ...
%undef = G_IMPLICIT_DEF
%vec = G_BUILD_VECTOR %elt, %undef, %undef, ... %undef
```

Can be selected to a SUBREG_TO_REG, assuming `%elt` and `%vec` have the same
register bank. We don't care about any of the bits in `%vec` aside from those
in `%elt`, which just happens to be the 0th element.

This is preferable to emitting `mov` instructions for every index.

This gives minor code size improvements on the test suite at -Os.

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




More information about the All-commits mailing list