[PATCH] D92475: [IR] Bail out for scalable vectors in ShuffleVectorInst::isConcat

Cullen Rhodes via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 7 03:03:36 PST 2020


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG7b1cb4715063: [IR] Bail out for scalable vectors in ShuffleVectorInst::isConcat (authored by c-rhodes).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92475/new/

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.309852.patch
Type: text/x-patch
Size: 1454 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201207/2119d207/attachment.bin>


More information about the llvm-commits mailing list