[llvm][CodeGen] Do not scalarize `llvm.masked.[gather|scatter]` operating on…

Authored by fpetrogalli on Sep 8 2020, 1:08 AM.


[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:

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

Reviewed By: efriedma, sdesmalen

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