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: kparzysz, sdesmalen, efriedma

Reviewed By: kparzysz

Subscribers: hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D77267
This commit is contained in:
Christopher Tetreault 2020-04-03 11:24:59 -07:00
parent 0c0831f74b
commit b600809688
2 changed files with 3 additions and 3 deletions

View File

@ -1087,7 +1087,7 @@ HexagonTargetLowering::LowerConstantPool(SDValue Op, SelectionDAG &DAG) const {
Constant *CVal = nullptr;
bool isVTi1Type = false;
if (auto *CV = dyn_cast<ConstantVector>(CPN->getConstVal())) {
if (CV->getType()->getVectorElementType()->isIntegerTy(1)) {
if (cast<VectorType>(CV->getType())->getElementType()->isIntegerTy(1)) {
IRBuilder<> IRB(CV->getContext());
SmallVector<Constant*, 128> NewConst;
unsigned VecLen = CV->getNumOperands();

View File

@ -60,8 +60,8 @@ bool HexagonTTIImpl::isTypeForHVX(Type *VecTy) const {
}
unsigned HexagonTTIImpl::getTypeNumElements(Type *Ty) const {
if (Ty->isVectorTy())
return Ty->getVectorNumElements();
if (auto *VTy = dyn_cast<VectorType>(Ty))
return VTy->getNumElements();
assert((Ty->isIntegerTy() || Ty->isFloatingPointTy()) &&
"Expecting scalar type");
return 1;