Skip to content

Commit d1409b8

Browse files
committed
Use to reuse MVT type
1 parent 0764369 commit d1409b8

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1146,9 +1146,7 @@ InstructionCost RISCVTTIImpl::getCastInstrCost(unsigned Opcode, Type *Dst,
11461146
MVT VecVT = DstLT.second.changeVectorElementType(ElementVT);
11471147
Cost += getRISCVInstructionCost(FNCVT, VecVT, CostKind);
11481148
if ((SrcEltSize >> 1) > DstEltSize) {
1149-
VectorType *VecTy = VectorType::get(
1150-
IntegerType::get(Dst->getContext(), SrcEltSize >> 1),
1151-
cast<VectorType>(Dst)->getElementCount());
1149+
Type *VecTy = EVT(VecVT).getTypeForEVT(Dst->getContext());
11521150
Cost +=
11531151
getCastInstrCost(Instruction::Trunc, Dst, VecTy, CCH, CostKind, I);
11541152
}

0 commit comments

Comments
 (0)