Seems to have very little compiled code size impact. But might give a tiny performance boost.
llvm-svn: 299811
/// 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.
}
}
-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;
}