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

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 29 09:17:14 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();
----------------
lukel97 wrote:

Ah ok, thanks for clarifying. I guess there's nothing stopping a frontend from just emitting vector LLVM IR independently of the autovectorizers.

I'm not strongly opinionated about where we check that the legalized type is vector, I presume both will result in an invalid cost

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


More information about the llvm-commits mailing list