[SVE] Eliminate calls to default-false VectorType::get() from AggressiveInstCombine

Reviewers: efriedma, aymanmus, c-rhodes, david-arm

Reviewed By: david-arm

Subscribers: tschuett, hiraditya, rkruppe, psnobl, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D80332
This commit is contained in:
Christopher Tetreault 2020-05-29 15:41:06 -07:00
parent 56eb7556e7
commit e6cf402e83
1 changed files with 4 additions and 2 deletions

View File

@ -281,8 +281,10 @@ Type *TruncInstCombine::getBestTruncatedType() {
/// version of \p Ty, otherwise return \p Ty.
static Type *getReducedType(Value *V, Type *Ty) {
assert(Ty && !Ty->isVectorTy() && "Expect Scalar Type");
if (auto *VTy = dyn_cast<VectorType>(V->getType()))
return VectorType::get(Ty, VTy->getNumElements());
if (auto *VTy = dyn_cast<VectorType>(V->getType())) {
// FIXME: should this handle scalable vectors?
return FixedVectorType::get(Ty, VTy->getNumElements());
}
return Ty;
}