[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:
Craig Topper 2017-04-08 05:47:09 +00:00
parent 52f987ac7f
commit 0a13ad6637
2 changed files with 5 additions and 7 deletions

View File

@ -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.

View File

@ -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;
}