Index: include/llvm/Support/LowLevelTypeImpl.h =================================================================== --- include/llvm/Support/LowLevelTypeImpl.h +++ include/llvm/Support/LowLevelTypeImpl.h @@ -70,6 +70,15 @@ ScalarTy.isPointer() ? ScalarTy.getAddressSpace() : 0}; } + static LLT scalarOrVector(uint16_t NumElements, LLT ScalarTy) { + return NumElements == 1 ? ScalarTy : LLT::vector(NumElements, ScalarTy); + } + + static LLT scalarOrVector(uint16_t NumElements, unsigned ScalarSize) { + LLT ScalarTy = LLT::scalar(ScalarSize); + return NumElements == 1 ? ScalarTy : LLT::vector(NumElements, ScalarTy); + } + explicit LLT(bool isPointer, bool isVector, uint16_t NumElements, unsigned SizeInBits, unsigned AddressSpace) { init(isPointer, isVector, NumElements, SizeInBits, AddressSpace);