[PATCH] D77236: [SVE] Cleanup prior to introdution of FixedVectorType
Christopher Tetreault via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 1 15:45:54 PDT 2020
ctetreau updated this revision to Diff 254327.
ctetreau added a comment.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Split commit up into multiple smaller commits:
1 commit per llvm library, 1 for clang, and 1 for mlir. Plus one final commit to remove the functions from Type
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D77236/new/
https://reviews.llvm.org/D77236
Files:
llvm/include/llvm/IR/DerivedTypes.h
llvm/include/llvm/IR/Type.h
llvm/lib/IR/Type.cpp
Index: llvm/lib/IR/Type.cpp
===================================================================
--- llvm/lib/IR/Type.cpp
+++ llvm/lib/IR/Type.cpp
@@ -149,6 +149,12 @@
return -1;
}
+Type *Type::getScalarType() const {
+ if (isVectorTy())
+ return cast<VectorType>(this)->getElementType();
+ return const_cast<Type *>(this);
+}
+
bool Type::isSizedDerivedType(SmallPtrSetImpl<Type*> *Visited) const {
if (auto *ATy = dyn_cast<ArrayType>(this))
return ATy->getElementType()->isSized(Visited);
Index: llvm/include/llvm/IR/Type.h
===================================================================
--- llvm/include/llvm/IR/Type.h
+++ llvm/include/llvm/IR/Type.h
@@ -304,11 +304,7 @@
/// If this is a vector type, return the element type, otherwise return
/// 'this'.
- Type *getScalarType() const {
- if (isVectorTy())
- return getVectorElementType();
- return const_cast<Type*>(this);
- }
+ Type *getScalarType() const;
//===--------------------------------------------------------------------===//
// Type Iteration support.
@@ -343,8 +339,8 @@
//===--------------------------------------------------------------------===//
// Helper methods corresponding to subclass methods. This forces a cast to
- // the specified subclass and calls its accessor. "getVectorNumElements" (for
- // example) is shorthand for cast<VectorType>(Ty)->getNumElements(). This is
+ // the specified subclass and calls its accessor. "getArrayNumElements" (for
+ // example) is shorthand for cast<ArrayType>(Ty)->getNumElements(). This is
// only intended to cover the core methods that are frequently used, helper
// methods should not be added here.
@@ -370,14 +366,6 @@
return ContainedTys[0];
}
- inline bool getVectorIsScalable() const;
- inline unsigned getVectorNumElements() const;
- inline ElementCount getVectorElementCount() const;
- Type *getVectorElementType() const {
- assert(getTypeID() == VectorTyID);
- return ContainedTys[0];
- }
-
Type *getPointerElementType() const {
assert(getTypeID() == PointerTyID);
return ContainedTys[0];
Index: llvm/include/llvm/IR/DerivedTypes.h
===================================================================
--- llvm/include/llvm/IR/DerivedTypes.h
+++ llvm/include/llvm/IR/DerivedTypes.h
@@ -546,18 +546,6 @@
}
};
-unsigned Type::getVectorNumElements() const {
- return cast<VectorType>(this)->getNumElements();
-}
-
-bool Type::getVectorIsScalable() const {
- return cast<VectorType>(this)->isScalable();
-}
-
-ElementCount Type::getVectorElementCount() const {
- return cast<VectorType>(this)->getElementCount();
-}
-
/// Class to represent pointers.
class PointerType : public Type {
explicit PointerType(Type *ElType, unsigned AddrSpace);
@@ -610,8 +598,8 @@
isIntOrIntVectorTy() &&
"Original type expected to be a vector of integers or a scalar integer.");
Type *NewType = getIntNTy(getContext(), NewBitWidth);
- if (isVectorTy())
- NewType = VectorType::get(NewType, getVectorElementCount());
+ if (auto *VTy = dyn_cast<VectorType>(this))
+ NewType = VectorType::get(NewType, VTy->getElementCount());
return NewType;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77236.254327.patch
Type: text/x-patch
Size: 3204 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200401/5cdcf68a/attachment-0001.bin>
More information about the cfe-commits
mailing list