Skip to content

Commit b7abc70

Browse files
committed
use ST->hasVInstructions() and reduce if-nesting
1 parent a46983a commit b7abc70

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp

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

0 commit comments

Comments
 (0)