[llvm] 3ecced1 - [SVE] Remove calls to isScalable from IR
Christopher Tetreault via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 23 11:51:42 PDT 2020
Author: Christopher Tetreault
Date: 2020-04-23T11:51:22-07:00
New Revision: 3ecced163f539dd04e86ba9dbf27e49bd89a4a11
URL: https://github.com/llvm/llvm-project/commit/3ecced163f539dd04e86ba9dbf27e49bd89a4a11
DIFF: https://github.com/llvm/llvm-project/commit/3ecced163f539dd04e86ba9dbf27e49bd89a4a11.diff
LOG: [SVE] Remove calls to isScalable from IR
Reviewers: efriedma, sdesmalen, dexonsmith, dblaikie
Reviewed By: sdesmalen
Subscribers: tschuett, hiraditya, rkruppe, psnobl, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D77691
Added:
Modified:
llvm/include/llvm/IR/GetElementPtrTypeIterator.h
llvm/include/llvm/IR/PatternMatch.h
llvm/lib/IR/AsmWriter.cpp
llvm/lib/IR/ConstantFold.cpp
llvm/lib/IR/Constants.cpp
llvm/lib/IR/ConstantsContext.h
llvm/lib/IR/Function.cpp
llvm/lib/IR/Instructions.cpp
llvm/lib/IR/Operator.cpp
llvm/lib/IR/Type.cpp
llvm/lib/IR/Verifier.cpp
llvm/unittests/IR/VectorTypesTest.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/IR/GetElementPtrTypeIterator.h b/llvm/include/llvm/IR/GetElementPtrTypeIterator.h
index 826b21ac1cb9..79ea5791b2fd 100644
--- a/llvm/include/llvm/IR/GetElementPtrTypeIterator.h
+++ b/llvm/include/llvm/IR/GetElementPtrTypeIterator.h
@@ -80,7 +80,7 @@ namespace llvm {
NumElements = ATy->getNumElements();
} else if (auto *VTy = dyn_cast<VectorType>(Ty)) {
CurTy = VTy->getElementType();
- if (VTy->isScalable())
+ if (isa<ScalableVectorType>(VTy))
NumElements = Unbounded;
else
NumElements = VTy->getNumElements();
diff --git a/llvm/include/llvm/IR/PatternMatch.h b/llvm/include/llvm/IR/PatternMatch.h
index 11a8d783e340..390301b61c0b 100644
--- a/llvm/include/llvm/IR/PatternMatch.h
+++ b/llvm/include/llvm/IR/PatternMatch.h
@@ -2173,8 +2173,8 @@ struct VScaleVal_match {
if (m_PtrToInt(m_OffsetGep(m_Zero(), m_SpecificInt(1))).match(V)) {
Type *PtrTy = cast<Operator>(V)->getOperand(0)->getType();
- auto *DerefTy = dyn_cast<VectorType>(PtrTy->getPointerElementType());
- if (DerefTy && DerefTy->isScalable() &&
+ auto *DerefTy = PtrTy->getPointerElementType();
+ if (isa<ScalableVectorType>(DerefTy) &&
DL.getTypeAllocSizeInBits(DerefTy).getKnownMinSize() == 8)
return true;
}
diff --git a/llvm/lib/IR/AsmWriter.cpp b/llvm/lib/IR/AsmWriter.cpp
index 5c8f9b0a81b5..b7d8287a9fea 100644
--- a/llvm/lib/IR/AsmWriter.cpp
+++ b/llvm/lib/IR/AsmWriter.cpp
@@ -464,7 +464,7 @@ static void PrintLLVMName(raw_ostream &OS, const Value *V) {
static void PrintShuffleMask(raw_ostream &Out, Type *Ty, ArrayRef<int> Mask) {
Out << ", <";
- if (cast<VectorType>(Ty)->isScalable())
+ if (isa<ScalableVectorType>(Ty))
Out << "vscale x ";
Out << Mask.size() << " x i32> ";
bool FirstElt = true;
diff --git a/llvm/lib/IR/ConstantFold.cpp b/llvm/lib/IR/ConstantFold.cpp
index d286379a8414..8539b91faf11 100644
--- a/llvm/lib/IR/ConstantFold.cpp
+++ b/llvm/lib/IR/ConstantFold.cpp
@@ -49,7 +49,7 @@ static Constant *BitCastConstantVector(Constant *CV, VectorType *DstTy) {
// Do not iterate on scalable vector. The num of elements is unknown at
// compile-time.
- if (DstTy->isScalable())
+ if (isa<ScalableVectorType>(DstTy))
return nullptr;
// If this cast changes element count then we can't handle it here:
@@ -848,7 +848,7 @@ Constant *llvm::ConstantFoldInsertElementInstruction(Constant *Val,
// Do not iterate on scalable vector. The num of elements is unknown at
// compile-time.
VectorType *ValTy = cast<VectorType>(Val->getType());
- if (ValTy->isScalable())
+ if (isa<ScalableVectorType>(ValTy))
return nullptr;
unsigned NumElts = cast<VectorType>(Val->getType())->getNumElements();
@@ -876,7 +876,7 @@ Constant *llvm::ConstantFoldShuffleVectorInstruction(Constant *V1, Constant *V2,
ArrayRef<int> Mask) {
auto *V1VTy = cast<VectorType>(V1->getType());
unsigned MaskNumElts = Mask.size();
- ElementCount MaskEltCount = {MaskNumElts, V1VTy->isScalable()};
+ ElementCount MaskEltCount = {MaskNumElts, isa<ScalableVectorType>(V1VTy)};
Type *EltTy = V1VTy->getElementType();
// Undefined shuffle mask -> undefined value.
@@ -895,7 +895,7 @@ Constant *llvm::ConstantFoldShuffleVectorInstruction(Constant *V1, Constant *V2,
}
// Do not iterate on scalable vector. The num of elements is unknown at
// compile-time.
- if (V1VTy->isScalable())
+ if (isa<ScalableVectorType>(V1VTy))
return nullptr;
unsigned SrcNumElts = V1VTy->getNumElements();
@@ -972,8 +972,7 @@ Constant *llvm::ConstantFoldUnaryInstruction(unsigned Opcode, Constant *C) {
// Handle scalar UndefValue and scalable vector UndefValue. Fixed-length
// vectors are always evaluated per element.
- bool IsScalableVector = isa<VectorType>(C->getType()) &&
- cast<VectorType>(C->getType())->isScalable();
+ bool IsScalableVector = isa<ScalableVectorType>(C->getType());
bool HasScalarUndefOrScalableVectorUndef =
(!C->getType()->isVectorTy() || IsScalableVector) && isa<UndefValue>(C);
@@ -1046,8 +1045,7 @@ Constant *llvm::ConstantFoldBinaryInstruction(unsigned Opcode, Constant *C1,
// Handle scalar UndefValue and scalable vector UndefValue. Fixed-length
// vectors are always evaluated per element.
- bool IsScalableVector = isa<VectorType>(C1->getType()) &&
- cast<VectorType>(C1->getType())->isScalable();
+ bool IsScalableVector = isa<ScalableVectorType>(C1->getType());
bool HasScalarUndefOrScalableVectorUndef =
(!C1->getType()->isVectorTy() || IsScalableVector) &&
(isa<UndefValue>(C1) || isa<UndefValue>(C2));
@@ -2000,7 +1998,7 @@ Constant *llvm::ConstantFoldCompareInstruction(unsigned short pred,
// Do not iterate on scalable vector. The number of elements is unknown at
// compile-time.
- if (C1VTy->isScalable())
+ if (isa<ScalableVectorType>(C1VTy))
return nullptr;
// Fast path for splatted constants.
diff --git a/llvm/lib/IR/Constants.cpp b/llvm/lib/IR/Constants.cpp
index d180059ccf13..5a3c6a44ceb2 100644
--- a/llvm/lib/IR/Constants.cpp
+++ b/llvm/lib/IR/Constants.cpp
@@ -241,7 +241,7 @@ bool Constant::isFiniteNonZeroFP() const {
bool Constant::isNormalFP() const {
if (auto *CFP = dyn_cast<ConstantFP>(this))
return CFP->getValueAPF().isNormal();
- auto *VTy = dyn_cast<VectorType>(getType());
+ auto *VTy = dyn_cast<FixedVectorType>(getType());
if (!VTy)
return false;
for (unsigned i = 0, e = VTy->getNumElements(); i != e; ++i) {
@@ -255,7 +255,7 @@ bool Constant::isNormalFP() const {
bool Constant::hasExactInverseFP() const {
if (auto *CFP = dyn_cast<ConstantFP>(this))
return CFP->getValueAPF().getExactInverse(nullptr);
- auto *VTy = dyn_cast<VectorType>(getType());
+ auto *VTy = dyn_cast<FixedVectorType>(getType());
if (!VTy)
return false;
for (unsigned i = 0, e = VTy->getNumElements(); i != e; ++i) {
@@ -269,7 +269,7 @@ bool Constant::hasExactInverseFP() const {
bool Constant::isNaN() const {
if (auto *CFP = dyn_cast<ConstantFP>(this))
return CFP->isNaN();
- auto *VTy = dyn_cast<VectorType>(getType());
+ auto *VTy = dyn_cast<FixedVectorType>(getType());
if (!VTy)
return false;
for (unsigned i = 0, e = VTy->getNumElements(); i != e; ++i) {
@@ -644,7 +644,7 @@ Constant *Constant::replaceUndefsWith(Constant *C, Constant *Replacement) {
}
// Don't know how to deal with this constant.
- auto *VTy = dyn_cast<VectorType>(Ty);
+ auto *VTy = dyn_cast<FixedVectorType>(Ty);
if (!VTy)
return C;
@@ -2287,7 +2287,7 @@ Constant *ConstantExpr::getShuffleVector(Constant *V1, Constant *V2,
unsigned NElts = Mask.size();
auto V1VTy = cast<VectorType>(V1->getType());
Type *EltTy = V1VTy->getElementType();
- bool TypeIsScalable = V1VTy->isScalable();
+ bool TypeIsScalable = isa<ScalableVectorType>(V1VTy);
Type *ShufTy = VectorType::get(EltTy, NElts, TypeIsScalable);
if (OnlyIfReducedTy == ShufTy)
diff --git a/llvm/lib/IR/ConstantsContext.h b/llvm/lib/IR/ConstantsContext.h
index 5dfd97e24e10..4cd2621f625d 100644
--- a/llvm/lib/IR/ConstantsContext.h
+++ b/llvm/lib/IR/ConstantsContext.h
@@ -148,11 +148,10 @@ class InsertElementConstantExpr : public ConstantExpr {
class ShuffleVectorConstantExpr : public ConstantExpr {
public:
ShuffleVectorConstantExpr(Constant *C1, Constant *C2, ArrayRef<int> Mask)
- : ConstantExpr(
- VectorType::get(cast<VectorType>(C1->getType())->getElementType(),
- Mask.size(),
- cast<VectorType>(C1->getType())->isScalable()),
- Instruction::ShuffleVector, &Op<0>(), 2) {
+ : ConstantExpr(VectorType::get(
+ cast<VectorType>(C1->getType())->getElementType(),
+ Mask.size(), isa<ScalableVectorType>(C1->getType())),
+ Instruction::ShuffleVector, &Op<0>(), 2) {
assert(ShuffleVectorInst::isValidOperands(C1, C2, Mask) &&
"Invalid shuffle vector instruction operands!");
Op<0>() = C1;
diff --git a/llvm/lib/IR/Function.cpp b/llvm/lib/IR/Function.cpp
index 972fe0ea85d3..53ab11775af9 100644
--- a/llvm/lib/IR/Function.cpp
+++ b/llvm/lib/IR/Function.cpp
@@ -1354,10 +1354,9 @@ static bool matchIntrinsicType(
return true;
}
case IITDescriptor::ScalableVecArgument: {
- VectorType *VTy = dyn_cast<VectorType>(Ty);
- if (!VTy || !VTy->isScalable())
+ if (!isa<ScalableVectorType>(Ty))
return true;
- return matchIntrinsicType(VTy, Infos, ArgTys, DeferredChecks,
+ return matchIntrinsicType(Ty, Infos, ArgTys, DeferredChecks,
IsDeferredCheck);
}
case IITDescriptor::VecOfBitcastsToInt: {
diff --git a/llvm/lib/IR/Instructions.cpp b/llvm/lib/IR/Instructions.cpp
index 99094c72951e..836169899f51 100644
--- a/llvm/lib/IR/Instructions.cpp
+++ b/llvm/lib/IR/Instructions.cpp
@@ -1879,8 +1879,7 @@ ShuffleVectorInst::ShuffleVectorInst(Value *V1, Value *V2, ArrayRef<int> Mask,
Instruction *InsertBefore)
: Instruction(
VectorType::get(cast<VectorType>(V1->getType())->getElementType(),
- Mask.size(),
- cast<VectorType>(V1->getType())->isScalable()),
+ Mask.size(), isa<ScalableVectorType>(V1->getType())),
ShuffleVector, OperandTraits<ShuffleVectorInst>::op_begin(this),
OperandTraits<ShuffleVectorInst>::operands(this), InsertBefore) {
assert(isValidOperands(V1, V2, Mask) &&
@@ -1895,8 +1894,7 @@ ShuffleVectorInst::ShuffleVectorInst(Value *V1, Value *V2, ArrayRef<int> Mask,
const Twine &Name, BasicBlock *InsertAtEnd)
: Instruction(
VectorType::get(cast<VectorType>(V1->getType())->getElementType(),
- Mask.size(),
- cast<VectorType>(V1->getType())->isScalable()),
+ Mask.size(), isa<ScalableVectorType>(V1->getType())),
ShuffleVector, OperandTraits<ShuffleVectorInst>::op_begin(this),
OperandTraits<ShuffleVectorInst>::operands(this), InsertAtEnd) {
assert(isValidOperands(V1, V2, Mask) &&
@@ -1938,7 +1936,7 @@ bool ShuffleVectorInst::isValidOperands(const Value *V1, const Value *V2,
if (Elem != UndefMaskElem && Elem >= V1Size * 2)
return false;
- if (cast<VectorType>(V1->getType())->isScalable())
+ if (isa<ScalableVectorType>(V1->getType()))
if ((Mask[0] != 0 && Mask[0] != UndefMaskElem) || !is_splat(Mask))
return false;
@@ -1951,10 +1949,11 @@ bool ShuffleVectorInst::isValidOperands(const Value *V1, const Value *V2,
if (!V1->getType()->isVectorTy() || V1->getType() != V2->getType())
return false;
- // Mask must be vector of i32.
+ // Mask must be vector of i32, and must be the same kind of vector as the
+ // input vectors
auto *MaskTy = dyn_cast<VectorType>(Mask->getType());
if (!MaskTy || !MaskTy->getElementType()->isIntegerTy(32) ||
- MaskTy->isScalable() != cast<VectorType>(V1->getType())->isScalable())
+ isa<ScalableVectorType>(MaskTy) != isa<ScalableVectorType>(V1->getType()))
return false;
// Check to see if Mask is valid.
@@ -2012,7 +2011,7 @@ void ShuffleVectorInst::setShuffleMask(ArrayRef<int> Mask) {
Constant *ShuffleVectorInst::convertShuffleMaskForBitcode(ArrayRef<int> Mask,
Type *ResultTy) {
Type *Int32Ty = Type::getInt32Ty(ResultTy->getContext());
- if (cast<VectorType>(ResultTy)->isScalable()) {
+ if (isa<ScalableVectorType>(ResultTy)) {
assert(is_splat(Mask) && "Unexpected shuffle");
Type *VecTy = VectorType::get(Int32Ty, Mask.size(), true);
if (Mask[0] == 0)
diff --git a/llvm/lib/IR/Operator.cpp b/llvm/lib/IR/Operator.cpp
index 54b7d56e6353..fc4c28c053df 100644
--- a/llvm/lib/IR/Operator.cpp
+++ b/llvm/lib/IR/Operator.cpp
@@ -46,9 +46,8 @@ bool GEPOperator::accumulateConstantOffset(const DataLayout &DL,
continue;
// Scalable vectors have are multiplied by a runtime constant.
- if (auto *VecTy = dyn_cast<VectorType>(GTI.getIndexedType()))
- if (VecTy->isScalable())
- return false;
+ if (isa<ScalableVectorType>(GTI.getIndexedType()))
+ return false;
// Handle a struct index, which adds its field offset to the pointer.
if (StructType *STy = GTI.getStructTypeOrNull()) {
diff --git a/llvm/lib/IR/Type.cpp b/llvm/lib/IR/Type.cpp
index b97b70167511..a86c09ebee26 100644
--- a/llvm/lib/IR/Type.cpp
+++ b/llvm/lib/IR/Type.cpp
@@ -511,11 +511,9 @@ StringRef StructType::getName() const {
}
bool StructType::isValidElementType(Type *ElemTy) {
- if (auto *VTy = dyn_cast<VectorType>(ElemTy))
- return !VTy->isScalable();
return !ElemTy->isVoidTy() && !ElemTy->isLabelTy() &&
!ElemTy->isMetadataTy() && !ElemTy->isFunctionTy() &&
- !ElemTy->isTokenTy();
+ !ElemTy->isTokenTy() && !isa<ScalableVectorType>(ElemTy);
}
bool StructType::isLayoutIdentical(StructType *Other) const {
@@ -573,11 +571,9 @@ ArrayType *ArrayType::get(Type *ElementType, uint64_t NumElements) {
}
bool ArrayType::isValidElementType(Type *ElemTy) {
- if (auto *VTy = dyn_cast<VectorType>(ElemTy))
- return !VTy->isScalable();
return !ElemTy->isVoidTy() && !ElemTy->isLabelTy() &&
!ElemTy->isMetadataTy() && !ElemTy->isFunctionTy() &&
- !ElemTy->isTokenTy();
+ !ElemTy->isTokenTy() && !isa<ScalableVectorType>(ElemTy);
}
//===----------------------------------------------------------------------===//
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index 47c1a3e77a62..de8217045835 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -698,8 +698,8 @@ void Verifier::visitGlobalVariable(const GlobalVariable &GV) {
// the runtime size. If the global is a struct or an array containing
// scalable vectors, that will be caught by the isValidElementType methods
// in StructType or ArrayType instead.
- if (auto *VTy = dyn_cast<VectorType>(GV.getValueType()))
- Assert(!VTy->isScalable(), "Globals cannot contain scalable vectors", &GV);
+ Assert(!isa<ScalableVectorType>(GV.getValueType()),
+ "Globals cannot contain scalable vectors", &GV);
if (!GV.hasInitializer()) {
visitGlobalValue(GV);
diff --git a/llvm/unittests/IR/VectorTypesTest.cpp b/llvm/unittests/IR/VectorTypesTest.cpp
index 606d0175360b..f631a1d4a7c2 100644
--- a/llvm/unittests/IR/VectorTypesTest.cpp
+++ b/llvm/unittests/IR/VectorTypesTest.cpp
@@ -23,63 +23,63 @@ TEST(VectorTypesTest, FixedLength) {
Type *Float64Ty = Type::getDoubleTy(Ctx);
VectorType *V8Int32Ty = VectorType::get(Int32Ty, 8);
- ASSERT_FALSE(V8Int32Ty->isScalable());
+ ASSERT_TRUE(isa<FixedVectorType>(V8Int32Ty));
EXPECT_EQ(V8Int32Ty->getNumElements(), 8U);
EXPECT_EQ(V8Int32Ty->getElementType()->getScalarSizeInBits(), 32U);
VectorType *V8Int16Ty = VectorType::get(Int16Ty, {8, false});
- ASSERT_FALSE(V8Int16Ty->isScalable());
+ ASSERT_TRUE(isa<FixedVectorType>(V8Int16Ty));
EXPECT_EQ(V8Int16Ty->getNumElements(), 8U);
EXPECT_EQ(V8Int16Ty->getElementType()->getScalarSizeInBits(), 16U);
ElementCount EltCnt(4, false);
VectorType *V4Int64Ty = VectorType::get(Int64Ty, EltCnt);
- ASSERT_FALSE(V4Int64Ty->isScalable());
+ ASSERT_TRUE(isa<FixedVectorType>(V4Int64Ty));
EXPECT_EQ(V4Int64Ty->getNumElements(), 4U);
EXPECT_EQ(V4Int64Ty->getElementType()->getScalarSizeInBits(), 64U);
VectorType *V2Int64Ty = VectorType::get(Int64Ty, EltCnt/2);
- ASSERT_FALSE(V2Int64Ty->isScalable());
+ ASSERT_TRUE(isa<FixedVectorType>(V2Int64Ty));
EXPECT_EQ(V2Int64Ty->getNumElements(), 2U);
EXPECT_EQ(V2Int64Ty->getElementType()->getScalarSizeInBits(), 64U);
VectorType *V8Int64Ty = VectorType::get(Int64Ty, EltCnt*2);
- ASSERT_FALSE(V8Int64Ty->isScalable());
+ ASSERT_TRUE(isa<FixedVectorType>(V8Int64Ty));
EXPECT_EQ(V8Int64Ty->getNumElements(), 8U);
EXPECT_EQ(V8Int64Ty->getElementType()->getScalarSizeInBits(), 64U);
VectorType *V4Float64Ty = VectorType::get(Float64Ty, EltCnt);
- ASSERT_FALSE(V4Float64Ty->isScalable());
+ ASSERT_TRUE(isa<FixedVectorType>(V4Float64Ty));
EXPECT_EQ(V4Float64Ty->getNumElements(), 4U);
EXPECT_EQ(V4Float64Ty->getElementType()->getScalarSizeInBits(), 64U);
VectorType *ExtTy = VectorType::getExtendedElementVectorType(V8Int16Ty);
EXPECT_EQ(ExtTy, V8Int32Ty);
- ASSERT_FALSE(ExtTy->isScalable());
+ ASSERT_TRUE(isa<FixedVectorType>(ExtTy));
EXPECT_EQ(ExtTy->getNumElements(), 8U);
EXPECT_EQ(ExtTy->getElementType()->getScalarSizeInBits(), 32U);
VectorType *TruncTy = VectorType::getTruncatedElementVectorType(V8Int32Ty);
EXPECT_EQ(TruncTy, V8Int16Ty);
- ASSERT_FALSE(TruncTy->isScalable());
+ ASSERT_TRUE(isa<FixedVectorType>(TruncTy));
EXPECT_EQ(TruncTy->getNumElements(), 8U);
EXPECT_EQ(TruncTy->getElementType()->getScalarSizeInBits(), 16U);
VectorType *HalvedTy = VectorType::getHalfElementsVectorType(V4Int64Ty);
EXPECT_EQ(HalvedTy, V2Int64Ty);
- ASSERT_FALSE(HalvedTy->isScalable());
+ ASSERT_TRUE(isa<FixedVectorType>(HalvedTy));
EXPECT_EQ(HalvedTy->getNumElements(), 2U);
EXPECT_EQ(HalvedTy->getElementType()->getScalarSizeInBits(), 64U);
VectorType *DoubledTy = VectorType::getDoubleElementsVectorType(V4Int64Ty);
EXPECT_EQ(DoubledTy, V8Int64Ty);
- ASSERT_FALSE(DoubledTy->isScalable());
+ ASSERT_TRUE(isa<FixedVectorType>(DoubledTy));
EXPECT_EQ(DoubledTy->getNumElements(), 8U);
EXPECT_EQ(DoubledTy->getElementType()->getScalarSizeInBits(), 64U);
VectorType *ConvTy = VectorType::getInteger(V4Float64Ty);
EXPECT_EQ(ConvTy, V4Int64Ty);
- ASSERT_FALSE(ConvTy->isScalable());
+ ASSERT_TRUE(isa<FixedVectorType>(ConvTy));
EXPECT_EQ(ConvTy->getNumElements(), 4U);
EXPECT_EQ(ConvTy->getElementType()->getScalarSizeInBits(), 64U);
@@ -97,63 +97,63 @@ TEST(VectorTypesTest, Scalable) {
Type *Float64Ty = Type::getDoubleTy(Ctx);
VectorType *ScV8Int32Ty = VectorType::get(Int32Ty, 8, true);
- ASSERT_TRUE(ScV8Int32Ty->isScalable());
+ ASSERT_TRUE(isa<ScalableVectorType>(ScV8Int32Ty));
EXPECT_EQ(ScV8Int32Ty->getNumElements(), 8U);
EXPECT_EQ(ScV8Int32Ty->getElementType()->getScalarSizeInBits(), 32U);
VectorType *ScV8Int16Ty = VectorType::get(Int16Ty, {8, true});
- ASSERT_TRUE(ScV8Int16Ty->isScalable());
+ ASSERT_TRUE(isa<ScalableVectorType>(ScV8Int16Ty));
EXPECT_EQ(ScV8Int16Ty->getNumElements(), 8U);
EXPECT_EQ(ScV8Int16Ty->getElementType()->getScalarSizeInBits(), 16U);
ElementCount EltCnt(4, true);
VectorType *ScV4Int64Ty = VectorType::get(Int64Ty, EltCnt);
- ASSERT_TRUE(ScV4Int64Ty->isScalable());
+ ASSERT_TRUE(isa<ScalableVectorType>(ScV4Int64Ty));
EXPECT_EQ(ScV4Int64Ty->getNumElements(), 4U);
EXPECT_EQ(ScV4Int64Ty->getElementType()->getScalarSizeInBits(), 64U);
VectorType *ScV2Int64Ty = VectorType::get(Int64Ty, EltCnt/2);
- ASSERT_TRUE(ScV2Int64Ty->isScalable());
+ ASSERT_TRUE(isa<ScalableVectorType>(ScV2Int64Ty));
EXPECT_EQ(ScV2Int64Ty->getNumElements(), 2U);
EXPECT_EQ(ScV2Int64Ty->getElementType()->getScalarSizeInBits(), 64U);
VectorType *ScV8Int64Ty = VectorType::get(Int64Ty, EltCnt*2);
- ASSERT_TRUE(ScV8Int64Ty->isScalable());
+ ASSERT_TRUE(isa<ScalableVectorType>(ScV8Int64Ty));
EXPECT_EQ(ScV8Int64Ty->getNumElements(), 8U);
EXPECT_EQ(ScV8Int64Ty->getElementType()->getScalarSizeInBits(), 64U);
VectorType *ScV4Float64Ty = VectorType::get(Float64Ty, EltCnt);
- ASSERT_TRUE(ScV4Float64Ty->isScalable());
+ ASSERT_TRUE(isa<ScalableVectorType>(ScV4Float64Ty));
EXPECT_EQ(ScV4Float64Ty->getNumElements(), 4U);
EXPECT_EQ(ScV4Float64Ty->getElementType()->getScalarSizeInBits(), 64U);
VectorType *ExtTy = VectorType::getExtendedElementVectorType(ScV8Int16Ty);
EXPECT_EQ(ExtTy, ScV8Int32Ty);
- ASSERT_TRUE(ExtTy->isScalable());
+ ASSERT_TRUE(isa<ScalableVectorType>(ExtTy));
EXPECT_EQ(ExtTy->getNumElements(), 8U);
EXPECT_EQ(ExtTy->getElementType()->getScalarSizeInBits(), 32U);
VectorType *TruncTy = VectorType::getTruncatedElementVectorType(ScV8Int32Ty);
EXPECT_EQ(TruncTy, ScV8Int16Ty);
- ASSERT_TRUE(TruncTy->isScalable());
+ ASSERT_TRUE(isa<ScalableVectorType>(TruncTy));
EXPECT_EQ(TruncTy->getNumElements(), 8U);
EXPECT_EQ(TruncTy->getElementType()->getScalarSizeInBits(), 16U);
VectorType *HalvedTy = VectorType::getHalfElementsVectorType(ScV4Int64Ty);
EXPECT_EQ(HalvedTy, ScV2Int64Ty);
- ASSERT_TRUE(HalvedTy->isScalable());
+ ASSERT_TRUE(isa<ScalableVectorType>(HalvedTy));
EXPECT_EQ(HalvedTy->getNumElements(), 2U);
EXPECT_EQ(HalvedTy->getElementType()->getScalarSizeInBits(), 64U);
VectorType *DoubledTy = VectorType::getDoubleElementsVectorType(ScV4Int64Ty);
EXPECT_EQ(DoubledTy, ScV8Int64Ty);
- ASSERT_TRUE(DoubledTy->isScalable());
+ ASSERT_TRUE(isa<ScalableVectorType>(DoubledTy));
EXPECT_EQ(DoubledTy->getNumElements(), 8U);
EXPECT_EQ(DoubledTy->getElementType()->getScalarSizeInBits(), 64U);
VectorType *ConvTy = VectorType::getInteger(ScV4Float64Ty);
EXPECT_EQ(ConvTy, ScV4Int64Ty);
- ASSERT_TRUE(ConvTy->isScalable());
+ ASSERT_TRUE(isa<ScalableVectorType>(ConvTy));
EXPECT_EQ(ConvTy->getNumElements(), 4U);
EXPECT_EQ(ConvTy->getElementType()->getScalarSizeInBits(), 64U);
More information about the llvm-commits
mailing list