mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-08 04:51:23 +00:00
[IR] Inline Type::getScalarType() by using isVectorTy() and getVectorElementType() that were already available inline.
Seems to have very little compiled code size impact. But might give a tiny performance boost. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299811 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
52f987ac7f
commit
0a13ad6637
@ -290,7 +290,11 @@ public:
|
||||
|
||||
/// If this is a vector type, return the element type, otherwise return
|
||||
/// 'this'.
|
||||
Type *getScalarType() const LLVM_READONLY;
|
||||
Type *getScalarType() const {
|
||||
if (isVectorTy())
|
||||
return getVectorElementType();
|
||||
return const_cast<Type*>(this);
|
||||
}
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
// Type Iteration support.
|
||||
|
@ -41,12 +41,6 @@ Type *Type::getPrimitiveType(LLVMContext &C, TypeID IDNumber) {
|
||||
}
|
||||
}
|
||||
|
||||
Type *Type::getScalarType() const {
|
||||
if (auto *VTy = dyn_cast<VectorType>(this))
|
||||
return VTy->getElementType();
|
||||
return const_cast<Type*>(this);
|
||||
}
|
||||
|
||||
bool Type::isIntegerTy(unsigned Bitwidth) const {
|
||||
return isIntegerTy() && cast<IntegerType>(this)->getBitWidth() == Bitwidth;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user