[PATCH] D92475: [IR] Bail out for scalable vectors in ShuffleVectorInst::isConcat
Cullen Rhodes via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 2 03:58:39 PST 2020
c-rhodes created this revision.
c-rhodes added reviewers: sdesmalen, ctetreau, craig.topper.
Herald added subscribers: dexonsmith, hiraditya.
Herald added a project: LLVM.
c-rhodes requested review of this revision.
Shuffle mask for concat can't be expressed for scalable vectors, so we
should bail out. A test has been added that previously crashed, also
tested isIdentityWithPadding and isIdentityWithExtract where we already
bail out.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D92475
Files:
llvm/lib/IR/Instructions.cpp
llvm/unittests/IR/InstructionsTest.cpp
Index: llvm/unittests/IR/InstructionsTest.cpp
===================================================================
--- llvm/unittests/IR/InstructionsTest.cpp
+++ llvm/unittests/IR/InstructionsTest.cpp
@@ -1096,6 +1096,17 @@
EXPECT_TRUE(Id14->changesLength());
EXPECT_TRUE(Id14->increasesLength());
delete Id14;
+
+ // Not possible to express these masks for scalable vectors, make sure we
+ // don't crash.
+ ShuffleVectorInst *Id15 =
+ new ShuffleVectorInst(Constant::getAllOnesValue(VScaleV2Int32Ty),
+ Constant::getNullValue(VScaleV2Int32Ty),
+ Constant::getNullValue(VScaleV2Int32Ty));
+ EXPECT_FALSE(Id15->isIdentityWithPadding());
+ EXPECT_FALSE(Id15->isIdentityWithExtract());
+ EXPECT_FALSE(Id15->isConcat());
+ delete Id15;
}
TEST(InstructionsTest, GetSplat) {
Index: llvm/lib/IR/Instructions.cpp
===================================================================
--- llvm/lib/IR/Instructions.cpp
+++ llvm/lib/IR/Instructions.cpp
@@ -2274,6 +2274,11 @@
isa<UndefValue>(Op<2>()))
return false;
+ // FIXME: Not currently possible to express a shuffle mask for a scalable
+ // vector for this case.
+ if (isa<ScalableVectorType>(getType()))
+ return false;
+
int NumOpElts = cast<FixedVectorType>(Op<0>()->getType())->getNumElements();
int NumMaskElts = cast<FixedVectorType>(getType())->getNumElements();
if (NumMaskElts != NumOpElts * 2)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92475.308930.patch
Type: text/x-patch
Size: 1454 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201202/5e211327/attachment.bin>
More information about the llvm-commits
mailing list