Skip to content

Commit 941841b

Browse files
[Vectorize] Update comment of getSubdividedVectorType (#107632)
The original comment here is wrong, as demonstrated by the included test. Update the comment to reflect what getSubdividedVectorType actually does.
1 parent de88d7d commit 941841b

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

llvm/include/llvm/IR/DerivedTypes.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -492,9 +492,9 @@ class VectorType : public Type {
492492
return VectorType::get(EltTy, VTy->getElementCount());
493493
}
494494

495-
// This static method returns a VectorType with a smaller number of elements
496-
// of a larger type than the input element type. For example, a <16 x i8>
497-
// subdivided twice would return <4 x i32>
495+
// This static method returns a VectorType with a larger number of elements
496+
// of a smaller type than the input element type. For example, a <4 x i64>
497+
// subdivided twice would return <16 x i16>
498498
static VectorType *getSubdividedVectorType(VectorType *VTy, int NumSubdivs) {
499499
for (int i = 0; i < NumSubdivs; ++i) {
500500
VTy = VectorType::getDoubleElementsVectorType(VTy);

llvm/unittests/IR/VectorTypesTest.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,10 @@ TEST(VectorTypesTest, FixedLength) {
125125
EltCnt = V8Int64Ty->getElementCount();
126126
EXPECT_EQ(EltCnt.getKnownMinValue(), 8U);
127127
ASSERT_FALSE(EltCnt.isScalable());
128+
129+
auto *SubTy = VectorType::getSubdividedVectorType(V4Int64Ty, 2);
130+
EXPECT_EQ(SubTy->getElementCount(), ElementCount::getFixed(16));
131+
EXPECT_TRUE(SubTy->getElementType()->isIntegerTy(16));
128132
}
129133

130134
TEST(VectorTypesTest, Scalable) {

0 commit comments

Comments
 (0)