[llvm] [RISCV] Fix crash when unrolling loop containing vector instructions (PR #83384)

Fraser Cormack via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 29 09:25:24 PST 2024


================
@@ -37,6 +37,9 @@ static cl::opt<unsigned> SLPMaxVF(
 InstructionCost
 RISCVTTIImpl::getRISCVInstructionCost(ArrayRef<unsigned> OpCodes, MVT VT,
                                       TTI::TargetCostKind CostKind) {
+  // Check if the type is valid for all CostKind
+  if (!VT.isVector())
+    return InstructionCost::getInvalid();
----------------
frasercrmck wrote:

Yeah, in our case it's because we're compiling OpenCL or SYCL, with vector data types in the source.

https://github.com/llvm/llvm-project/pull/83384


More information about the llvm-commits mailing list