[PATCH] D80342: [SVE] Deprecate default false variant of VectorType::get

Christopher Tetreault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 9 14:55:03 PDT 2020


ctetreau updated this revision to Diff 269684.
ctetreau added a comment.

rebase


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80342/new/

https://reviews.llvm.org/D80342

Files:
  llvm/include/llvm/IR/DerivedTypes.h


Index: llvm/include/llvm/IR/DerivedTypes.h
===================================================================
--- llvm/include/llvm/IR/DerivedTypes.h
+++ llvm/include/llvm/IR/DerivedTypes.h
@@ -443,8 +443,20 @@
 
   /// This static method is the primary way to construct an VectorType.
   static VectorType *get(Type *ElementType, ElementCount EC);
+
+  /// Base class getter that specifically constructs a FixedVectorType. This
+  /// function is deprecated, and will be removed after LLVM 11 ships. Since
+  /// this always returns a FixedVectorType via a base VectorType pointer,
+  /// FixedVectorType::get(Type *, unsigned) is strictly better since no cast is
+  /// required to call getNumElements() on the result.
+  LLVM_ATTRIBUTE_DEPRECATED(
+      inline static VectorType *get(Type *ElementType, unsigned NumElements),
+      "The base class version of get with the scalable argument defaulted to "
+      "false is deprecated. Either call VectorType::get(Type *, unsigned, "
+      "bool) and pass false, or call FixedVectorType::get(Type *, unsigned).");
+
   static VectorType *get(Type *ElementType, unsigned NumElements,
-                         bool Scalable = false) {
+                         bool Scalable) {
     return VectorType::get(ElementType, {NumElements, Scalable});
   }
 
@@ -537,6 +549,10 @@
   }
 };
 
+inline VectorType *VectorType::get(Type *ElementType, unsigned NumElements) {
+  return VectorType::get(ElementType, NumElements, false);
+}
+
 bool Type::isVectorTy() const { return isa<VectorType>(this); }
 
 /// Class to represent fixed width SIMD vectors


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80342.269684.patch
Type: text/x-patch
Size: 1598 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200609/d78ee3bf/attachment.bin>


More information about the llvm-commits mailing list