[PATCH] D92472: [IR] Support scalable vectors in ShuffleVectorInst::increasesLength
Cullen Rhodes via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 7 02:43:42 PST 2020
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG9b0189655500: [IR] Support scalable vectors in ShuffleVectorInst::increasesLength (authored by c-rhodes).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D92472/new/
https://reviews.llvm.org/D92472
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
@@ -1083,7 +1083,19 @@
Constant::getNullValue(VScaleV4Int32Ty));
int Index = 0;
EXPECT_FALSE(Id13->isExtractSubvectorMask(Index));
+ EXPECT_FALSE(Id13->changesLength());
+ EXPECT_FALSE(Id13->increasesLength());
delete Id13;
+
+ // Result has twice as many operands.
+ Type *VScaleV2Int32Ty = ScalableVectorType::get(Int32Ty, 2);
+ ShuffleVectorInst *Id14 =
+ new ShuffleVectorInst(Constant::getAllOnesValue(VScaleV2Int32Ty),
+ UndefValue::get(VScaleV2Int32Ty),
+ Constant::getNullValue(VScaleV4Int32Ty));
+ EXPECT_TRUE(Id14->changesLength());
+ EXPECT_TRUE(Id14->increasesLength());
+ delete Id14;
}
TEST(InstructionsTest, GetSplat) {
Index: llvm/include/llvm/IR/Instructions.h
===================================================================
--- llvm/include/llvm/IR/Instructions.h
+++ llvm/include/llvm/IR/Instructions.h
@@ -2081,8 +2081,9 @@
/// elements than its source vectors.
/// Example: shufflevector <2 x n> A, <2 x n> B, <1,2,3>
bool increasesLength() const {
- unsigned NumSourceElts =
- cast<FixedVectorType>(Op<0>()->getType())->getNumElements();
+ unsigned NumSourceElts = cast<VectorType>(Op<0>()->getType())
+ ->getElementCount()
+ .getKnownMinValue();
unsigned NumMaskElts = ShuffleMask.size();
return NumSourceElts < NumMaskElts;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92472.309851.patch
Type: text/x-patch
Size: 1662 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201207/d2b7465e/attachment.bin>
More information about the llvm-commits
mailing list