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

Christopher Tetreault via llvm-commits llvm-commits at lists.llvm.org
Fri May 29 15:49:59 PDT 2020


Author: Christopher Tetreault
Date: 2020-05-29T15:49:33-07:00
New Revision: e6cf402e8364a7a7e483a60aa1fca1213f4fb475

URL: https://github.com/llvm/llvm-project/commit/e6cf402e8364a7a7e483a60aa1fca1213f4fb475
DIFF: https://github.com/llvm/llvm-project/commit/e6cf402e8364a7a7e483a60aa1fca1213f4fb475.diff

LOG: [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

Added: 
    

Modified: 
    llvm/lib/Transforms/AggressiveInstCombine/TruncInstCombine.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/AggressiveInstCombine/TruncInstCombine.cpp b/llvm/lib/Transforms/AggressiveInstCombine/TruncInstCombine.cpp
index e41b2856c8d8..1f0989d230f8 100644
--- a/llvm/lib/Transforms/AggressiveInstCombine/TruncInstCombine.cpp
+++ b/llvm/lib/Transforms/AggressiveInstCombine/TruncInstCombine.cpp
@@ -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;
 }
 


        


More information about the llvm-commits mailing list