[PATCH] D77763: [SVE] Change return type of getNumElements to unsigned

Christopher Tetreault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 8 16:52:06 PDT 2020


ctetreau created this revision.
Herald added subscribers: llvm-commits, frgossen, grosul1, Joonsoo, liufengdb, aartbik, lucyrfox, mgester, arpith-jacob, nicolasvasilache, antiagainst, shauheen, burmako, jpienaar, rriddle, mehdi_amini, psnobl, rkruppe, hiraditya, tschuett.
Herald added a reviewer: efriedma.
Herald added a project: LLVM.
ctetreau added child revisions: D77276: Clean up usages of asserting vector getters in Type, D77272: Clean up usages of asserting vector getters in Type, D77258: Clean up usages of asserting vector getters in Type.
ctetreau removed child revisions: D77258: Clean up usages of asserting vector getters in Type, D77272: Clean up usages of asserting vector getters in Type, D77276: Clean up usages of asserting vector getters in Type.
ctetreau added parent revisions: D77258: Clean up usages of asserting vector getters in Type, D77272: Clean up usages of asserting vector getters in Type, D77276: Clean up usages of asserting vector getters in Type.
ctetreau added a child revision: D77278: Remove asserting getters from base Type.
ctetreau added reviewers: sdesmalen, craig.topper, dexonsmith.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D77763

Files:
  llvm/include/llvm/CodeGen/BasicTTIImpl.h
  llvm/include/llvm/IR/DerivedTypes.h
  llvm/lib/IR/Function.cpp
  mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp


Index: mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp
===================================================================
--- mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp
+++ mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp
@@ -1749,10 +1749,10 @@
         op, operands, typeConverter,
         [&](LLVM::LLVMType llvmVectorTy, ValueRange operands) {
           auto splatAttr = SplatElementsAttr::get(
-              mlir::VectorType::get({(unsigned)cast<llvm::VectorType>(
-                                         llvmVectorTy.getUnderlyingType())
-                                         ->getNumElements()},
-                                    floatType),
+              mlir::VectorType::get(
+                  {cast<llvm::VectorType>(llvmVectorTy.getUnderlyingType())
+                       ->getNumElements()},
+                  floatType),
               floatOne);
           auto one =
               rewriter.create<LLVM::ConstantOp>(loc, llvmVectorTy, splatAttr);
Index: llvm/lib/IR/Function.cpp
===================================================================
--- llvm/lib/IR/Function.cpp
+++ llvm/lib/IR/Function.cpp
@@ -1063,8 +1063,7 @@
     return Tys[D.getOverloadArgNumber()];
   case IITDescriptor::ScalableVecArgument: {
     auto *Ty = cast<VectorType>(DecodeFixedType(Infos, Tys, Context));
-    return VectorType::get(Ty->getElementType(),
-                           {(unsigned)Ty->getNumElements(), true});
+    return VectorType::get(Ty->getElementType(), {Ty->getNumElements(), true});
   }
   }
   llvm_unreachable("unhandled");
Index: llvm/include/llvm/IR/DerivedTypes.h
===================================================================
--- llvm/include/llvm/IR/DerivedTypes.h
+++ llvm/include/llvm/IR/DerivedTypes.h
@@ -417,7 +417,7 @@
   /// Get the number of elements in this vector. It does not make sense to call
   /// this function on a scalable vector, and this will be moved into
   /// FixedVectorType in a future commit
-  uint64_t getNumElements() const { return EC.Min; }
+  unsigned getNumElements() const { return EC.Min; }
 
   Type *getElementType() const { return ContainedType; }
 
Index: llvm/include/llvm/CodeGen/BasicTTIImpl.h
===================================================================
--- llvm/include/llvm/CodeGen/BasicTTIImpl.h
+++ llvm/include/llvm/CodeGen/BasicTTIImpl.h
@@ -1219,8 +1219,8 @@
       if (RetTy->isVectorTy()) {
         if (ScalarizationCostPassed == std::numeric_limits<unsigned>::max())
           ScalarizationCost = getScalarizationOverhead(RetTy, true, false);
-        ScalarCalls = std::max(
-            ScalarCalls, (unsigned)cast<VectorType>(RetTy)->getNumElements());
+        ScalarCalls =
+            std::max(ScalarCalls, cast<VectorType>(RetTy)->getNumElements());
         ScalarRetTy = RetTy->getScalarType();
       }
       SmallVector<Type *, 4> ScalarTys;
@@ -1229,8 +1229,8 @@
         if (Ty->isVectorTy()) {
           if (ScalarizationCostPassed == std::numeric_limits<unsigned>::max())
             ScalarizationCost += getScalarizationOverhead(Ty, false, true);
-          ScalarCalls = std::max(
-              ScalarCalls, (unsigned)cast<VectorType>(Ty)->getNumElements());
+          ScalarCalls =
+              std::max(ScalarCalls, cast<VectorType>(Ty)->getNumElements());
           Ty = Ty->getScalarType();
         }
         ScalarTys.push_back(Ty);
@@ -1577,8 +1577,7 @@
           if (ScalarizationCostPassed == std::numeric_limits<unsigned>::max())
             ScalarizationCost += getScalarizationOverhead(Tys[i], false, true);
           ScalarCalls =
-              std::max(ScalarCalls,
-                       (unsigned)cast<VectorType>(Tys[i])->getNumElements());
+              std::max(ScalarCalls, cast<VectorType>(Tys[i])->getNumElements());
         }
       }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77763.256143.patch
Type: text/x-patch
Size: 3831 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200408/aa8d5391/attachment.bin>


More information about the llvm-commits mailing list