[SVE] Eliminate calls to default-false VectorType::get() from AggressiveInstCombine
authorChristopher Tetreault <ctetreau@quicinc.com>
Fri, 29 May 2020 22:41:06 +0000 (15:41 -0700)
committerChristopher Tetreault <ctetreau@quicinc.com>
Fri, 29 May 2020 22:49:33 +0000 (15:49 -0700)
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

llvm/lib/Transforms/AggressiveInstCombine/TruncInstCombine.cpp

index e41b285..1f0989d 100644 (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;
 }