[llvm][CodeGen] Do not scalarize `llvm.masked.[gather|scatter]` operating on scalable...
authorFrancesco Petrogalli <francesco.petrogalli@arm.com>
Tue, 8 Sep 2020 08:08:59 +0000 (08:08 +0000)
committerFrancesco Petrogalli <francesco.petrogalli@arm.com>
Wed, 16 Sep 2020 16:00:28 +0000 (16:00 +0000)
commit15e9a6c2118fa3db2c80043e6679da5dcc72b3a7
treea5e3241e6d36ab479b392706e56f1e9c15a6d599
parent09c342493d89c2f32602f911e5c919742b837e10
[llvm][CodeGen] Do not scalarize `llvm.masked.[gather|scatter]` operating on scalable vectors.

This patch prevents the `llvm.masked.gather` and `llvm.masked.scatter` intrinsics to be scalarized when invoked on scalable vectors.

The change in `Function.cpp` is needed to prevent the warning that is raised when `getNumElements` is used in place of `getElementCount` on `VectorType` instances. The tests guards for regressions on this change.

The tests makes sure that calls to `llvm.masked.[gather|scatter]` are still scalarized when:

  # the intrinsics are operating on fixed size vectors, and
  # the compiler is not targeting fixed length SVE code generation.

Reviewed By: efriedma, sdesmalen

Differential Revision: https://reviews.llvm.org/D86249
llvm/lib/CodeGen/ScalarizeMaskedMemIntrin.cpp
llvm/lib/IR/Function.cpp
llvm/test/CodeGen/AArch64/llvm-masked-gather-legal-for-sve.ll [new file with mode: 0644]
llvm/test/CodeGen/AArch64/llvm-masked-scatter-legal-for-sve.ll [new file with mode: 0644]