In IRTranslator::translateGetElementPtr, when we run into a vector gep with some scalar operands, we try to normalize those operands using buildSplatVector.
This is fine except for when the getelementptr has a <1 x N> type. In that case it is treated as a scalar. If we run into one of these then every call to
// With VectorWidth = 1 LLT::fixed_vector(VectorWidth, PtrTy)
will assert.
Here's an example (equivalent to the added testcase):
https://godbolt.org/z/hGsTnMYdW
llc: llvm/include/llvm/Support/LowLevelTypeImpl.h:67: static llvm::LLT llvm::LLT::vector(llvm::ElementCount, llvm::LLT): Assertion `!EC.isScalar() && "invalid number of vector elements"' failed.
To get around this, this patch adds a variable, WantSplatVector, which is true when our vector type ought to actually be represented using a vector. When it's false, we'll translate as a scalar. This checks if VectorWidth > 1.
This fixes this bug: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=35496