Index: llvm/lib/IR/Instructions.cpp =================================================================== --- llvm/lib/IR/Instructions.cpp +++ llvm/lib/IR/Instructions.cpp @@ -2274,6 +2274,11 @@ isa(Op<2>())) return false; + // FIXME: Not currently possible to express a shuffle mask for a scalable + // vector for this case. + if (isa(getType())) + return false; + int NumOpElts = cast(Op<0>()->getType())->getNumElements(); int NumMaskElts = cast(getType())->getNumElements(); if (NumMaskElts != NumOpElts * 2) 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) {