Skip to content

Commit 6d516c6

Browse files
authored
[llvm][RISCV] Do not assume V extension on seeing vector type. (#166994)
We have a private extension which also uses the vector type in the frontend. Our platform does not have the V extension, so it triggered assertion failures from within getLMULCost(). It feels reasonable to check for V extension before assuming LMUL exists.
1 parent 53b64b0 commit 6d516c6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2140,7 +2140,8 @@ InstructionCost RISCVTTIImpl::getMemoryOpCost(unsigned Opcode, Type *Src,
21402140
// Assume memory ops cost scale with the number of vector registers
21412141
// possible accessed by the instruction. Note that BasicTTI already
21422142
// handles the LT.first term for us.
2143-
if (LT.second.isVector() && CostKind != TTI::TCK_CodeSize)
2143+
if (ST->hasVInstructions() && LT.second.isVector() &&
2144+
CostKind != TTI::TCK_CodeSize)
21442145
BaseCost *= TLI->getLMULCost(LT.second);
21452146
return Cost + BaseCost;
21462147
}

0 commit comments

Comments
 (0)