Commit eab73dfe authored by Christopher Tetreault's avatar Christopher Tetreault
Browse files

[SVE] Change return type of getNumElements to unsigned

Reviewers: efriedma, sdesmalen, craig.topper, dexonsmith

Reviewed By: efriedma, sdesmalen

Subscribers: tschuett, hiraditya, rkruppe, psnobl, mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, aartbik, liufengdb, Joonsoo, grosul1, frgossen, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D77763
parent 5f916652
......@@ -1214,8 +1214,8 @@ public:
if (RetTy->isVectorTy()) {
if (ScalarizationCostPassed == std::numeric_limits<unsigned>::max())
ScalarizationCost = getScalarizationOverhead(RetTy, true, false);
ScalarCalls = std::max(
ScalarCalls, (unsigned)cast<VectorType>(RetTy)->getNumElements());
ScalarCalls =
std::max(ScalarCalls, cast<VectorType>(RetTy)->getNumElements());
ScalarRetTy = RetTy->getScalarType();
}
SmallVector<Type *, 4> ScalarTys;
......@@ -1224,8 +1224,8 @@ public:
if (Ty->isVectorTy()) {
if (ScalarizationCostPassed == std::numeric_limits<unsigned>::max())
ScalarizationCost += getScalarizationOverhead(Ty, false, true);
ScalarCalls = std::max(
ScalarCalls, (unsigned)cast<VectorType>(Ty)->getNumElements());
ScalarCalls =
std::max(ScalarCalls, cast<VectorType>(Ty)->getNumElements());
Ty = Ty->getScalarType();
}
ScalarTys.push_back(Ty);
......@@ -1572,8 +1572,7 @@ public:
if (ScalarizationCostPassed == std::numeric_limits<unsigned>::max())
ScalarizationCost += getScalarizationOverhead(Tys[i], false, true);
ScalarCalls =
std::max(ScalarCalls,
(unsigned)cast<VectorType>(Tys[i])->getNumElements());
std::max(ScalarCalls, cast<VectorType>(Tys[i])->getNumElements());
}
}
......
......@@ -420,7 +420,7 @@ public:
/// For scalable vectors, this will return the minimum number of elements
/// in the vector.
uint64_t getNumElements() const { return NumElements; }
unsigned getNumElements() const { return NumElements; }
Type *getElementType() const { return ContainedType; }
/// This static method is the primary way to construct an VectorType.
......
......@@ -1075,8 +1075,7 @@ static Type *DecodeFixedType(ArrayRef<Intrinsic::IITDescriptor> &Infos,
return Tys[D.getOverloadArgNumber()];
case IITDescriptor::ScalableVecArgument: {
auto *Ty = cast<VectorType>(DecodeFixedType(Infos, Tys, Context));
return VectorType::get(Ty->getElementType(),
{(unsigned)Ty->getNumElements(), true});
return VectorType::get(Ty->getElementType(), {Ty->getNumElements(), true});
}
}
llvm_unreachable("unhandled");
......
......@@ -1802,10 +1802,10 @@ struct RsqrtOpLowering : public ConvertOpToLLVMPattern<RsqrtOp> {
op, operands, typeConverter,
[&](LLVM::LLVMType llvmVectorTy, ValueRange operands) {
auto splatAttr = SplatElementsAttr::get(
mlir::VectorType::get({(unsigned)cast<llvm::VectorType>(
llvmVectorTy.getUnderlyingType())
->getNumElements()},
floatType),
mlir::VectorType::get(
{cast<llvm::VectorType>(llvmVectorTy.getUnderlyingType())
->getNumElements()},
floatType),
floatOne);
auto one =
rewriter.create<LLVM::ConstantOp>(loc, llvmVectorTy, splatAttr);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment