Clean up usages of asserting vector getters in Type

Summary:
Remove usages of asserting vector getters in Type in preparation for the
VectorType refactor. The existence of these functions complicates the
refactor while adding little value.

Reviewers: arsenm, efriedma, sdesmalen

Reviewed By: arsenm

Subscribers: wdng, arsenm, jvesely, nhaehnle, hiraditya, kerbowa, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D77268
This commit is contained in:
Christopher Tetreault 2020-04-09 13:01:05 -07:00
parent 6ed88afd78
commit e634f482ea
2 changed files with 5 additions and 5 deletions

View File

@ -153,7 +153,7 @@ ValueType MetadataStreamerV2::getValueType(Type *Ty, StringRef TypeName) const {
case Type::PointerTyID:
return getValueType(Ty->getPointerElementType(), TypeName);
case Type::VectorTyID:
return getValueType(Ty->getVectorElementType(), TypeName);
return getValueType(cast<VectorType>(Ty)->getElementType(), TypeName);
default:
return ValueType::Struct;
}
@ -188,7 +188,7 @@ std::string MetadataStreamerV2::getTypeName(Type *Ty, bool Signed) const {
case Type::VectorTyID: {
auto VecTy = cast<VectorType>(Ty);
auto ElTy = VecTy->getElementType();
auto NumElements = VecTy->getVectorNumElements();
auto NumElements = VecTy->getNumElements();
return (Twine(getTypeName(ElTy, Signed)) + Twine(NumElements)).str();
}
default:
@ -600,7 +600,7 @@ StringRef MetadataStreamerV3::getValueType(Type *Ty, StringRef TypeName) const {
case Type::PointerTyID:
return getValueType(Ty->getPointerElementType(), TypeName);
case Type::VectorTyID:
return getValueType(Ty->getVectorElementType(), TypeName);
return getValueType(cast<VectorType>(Ty)->getElementType(), TypeName);
default:
return "struct";
}
@ -635,7 +635,7 @@ std::string MetadataStreamerV3::getTypeName(Type *Ty, bool Signed) const {
case Type::VectorTyID: {
auto VecTy = cast<VectorType>(Ty);
auto ElTy = VecTy->getElementType();
auto NumElements = VecTy->getVectorNumElements();
auto NumElements = VecTy->getNumElements();
return (Twine(getTypeName(ElTy, Signed)) + Twine(NumElements)).str();
}
default:

View File

@ -152,7 +152,7 @@ bool AMDGPULowerKernelArguments::runOnFunction(Function &F) {
}
if (IsV3 && Size >= 32) {
V4Ty = VectorType::get(VT->getVectorElementType(), 4);
V4Ty = VectorType::get(VT->getElementType(), 4);
// Use the hack that clang uses to avoid SelectionDAG ruining v3 loads
AdjustedArgTy = V4Ty;
}