[PATCH] D92312: [IR] Disallow scalable vectors in ShuffleVectorInst::isExtractSubvectorMask
Cullen Rhodes via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 30 05:24:22 PST 2020
c-rhodes created this revision.
c-rhodes added reviewers: david-arm, RKSimon, craig.topper.
Herald added a subscriber: dexonsmith.
Herald added a project: LLVM.
c-rhodes requested review of this revision.
It's not possible to express an extract subvector shuffle mask for
a scalable vector.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D92312
Files:
llvm/include/llvm/IR/Instructions.h
llvm/unittests/IR/InstructionsTest.cpp
Index: llvm/unittests/IR/InstructionsTest.cpp
===================================================================
--- llvm/unittests/IR/InstructionsTest.cpp
+++ llvm/unittests/IR/InstructionsTest.cpp
@@ -1073,6 +1073,17 @@
EXPECT_FALSE(Id12->isIdentityWithExtract());
EXPECT_FALSE(Id12->isConcat());
delete Id12;
+
+ // Not possible to express shuffle mask for scalable vector for extract
+ // subvector.
+ Type *VScaleV4Int32Ty = ScalableVectorType::get(Int32Ty, 4);
+ ShuffleVectorInst *Id13 =
+ new ShuffleVectorInst(Constant::getAllOnesValue(VScaleV4Int32Ty),
+ UndefValue::get(VScaleV4Int32Ty),
+ Constant::getNullValue(VScaleV4Int32Ty));
+ int Index = 0;
+ EXPECT_FALSE(Id13->isExtractSubvectorMask(Index));
+ delete Id13;
}
TEST(InstructionsTest, GetSplat) {
Index: llvm/include/llvm/IR/Instructions.h
===================================================================
--- llvm/include/llvm/IR/Instructions.h
+++ llvm/include/llvm/IR/Instructions.h
@@ -2267,7 +2267,8 @@
int &Index);
static bool isExtractSubvectorMask(const Constant *Mask, int NumSrcElts,
int &Index) {
- assert(Mask->getType()->isVectorTy() && "Shuffle needs vector constant.");
+ assert(isa<FixedVectorType>(Mask->getType()) &&
+ "Shuffle needs vector constant.");
SmallVector<int, 16> MaskAsInts;
getShuffleMask(Mask, MaskAsInts);
return isExtractSubvectorMask(MaskAsInts, NumSrcElts, Index);
@@ -2275,6 +2276,11 @@
/// Return true if this shuffle mask is an extract subvector mask.
bool isExtractSubvectorMask(int &Index) const {
+ // Not possible to express a shuffle mask for a scalable vector for this
+ // case.
+ if (isa<ScalableVectorType>(getType()))
+ return false;
+
int NumSrcElts =
cast<FixedVectorType>(Op<0>()->getType())->getNumElements();
return isExtractSubvectorMask(ShuffleMask, NumSrcElts, Index);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92312.308331.patch
Type: text/x-patch
Size: 2027 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201130/b5147e18/attachment.bin>
More information about the llvm-commits
mailing list