Skip to content

Commit a46983a

Browse files
committed
[llvm][RISCV] Do not assume V extension on seeing vector type.
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(). I am not sure what is the best way to handle this, or if there are more such assertions within the codebase. But it feels reasonable to check for V extension before assuming LMUL exists.
1 parent c6969e5 commit a46983a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2140,8 +2140,9 @@ 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)
2144-
BaseCost *= TLI->getLMULCost(LT.second);
2143+
if (TLI->getSubtarget().hasVInstructions())
2144+
if (LT.second.isVector() && CostKind != TTI::TCK_CodeSize)
2145+
BaseCost *= TLI->getLMULCost(LT.second);
21452146
return Cost + BaseCost;
21462147
}
21472148

0 commit comments

Comments
 (0)