diff options
author | Francesco Petrogalli <francesco.petrogalli@arm.com> | 2020-09-08 08:08:59 +0000 |
---|---|---|
committer | Francesco Petrogalli <francesco.petrogalli@arm.com> | 2020-09-16 16:00:28 +0000 |
commit | 15e9a6c2118fa3db2c80043e6679da5dcc72b3a7 (patch) | |
tree | a5e3241e6d36ab479b392706e56f1e9c15a6d599 /llvm/lib/IR/Function.cpp | |
parent | 09c342493d89c2f32602f911e5c919742b837e10 (diff) | |
download | llvm-15e9a6c2118fa3db2c80043e6679da5dcc72b3a7.zip llvm-15e9a6c2118fa3db2c80043e6679da5dcc72b3a7.tar.gz llvm-15e9a6c2118fa3db2c80043e6679da5dcc72b3a7.tar.bz2 |
[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
Diffstat (limited to 'llvm/lib/IR/Function.cpp')
-rw-r--r-- | llvm/lib/IR/Function.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/llvm/lib/IR/Function.cpp b/llvm/lib/IR/Function.cpp index e701fea..d03ffbb 100644 --- a/llvm/lib/IR/Function.cpp +++ b/llvm/lib/IR/Function.cpp @@ -1400,8 +1400,7 @@ static bool matchIntrinsicType( auto *ReferenceType = dyn_cast<VectorType>(ArgTys[RefArgNumber]); auto *ThisArgVecTy = dyn_cast<VectorType>(Ty); if (!ThisArgVecTy || !ReferenceType || - (cast<FixedVectorType>(ReferenceType)->getNumElements() != - cast<FixedVectorType>(ThisArgVecTy)->getNumElements())) + (ReferenceType->getElementCount() != ThisArgVecTy->getElementCount())) return true; PointerType *ThisArgEltTy = dyn_cast<PointerType>(ThisArgVecTy->getElementType()); |