Skip to content

Commit 681766d

Browse files
committed
Correcting incorrect cost calculation
1 parent 191345e commit 681766d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

llvm/lib/Transforms/Vectorize/VectorCombine.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2809,9 +2809,11 @@ bool VectorCombine::foldInsExtVectorToShuffle(Instruction &I) {
28092809

28102810
TTI::TargetCostKind CostKind = TTI::TCK_RecipThroughput;
28112811
InstructionCost OldCost =
2812-
TTI.getVectorInstrCost(*Ext, VecTy, CostKind, ExtIdx);
2812+
TTI.getVectorInstrCost(*Ext, VecTy, CostKind, ExtIdx) +
2813+
TTI.getVectorInstrCost(*Ins, VecTy, CostKind, InsIdx);
2814+
28132815
InstructionCost NewCost =
2814-
TTI.getShuffleCost(TargetTransformInfo::SK_Select, VecTy, Mask);
2816+
TTI.getShuffleCost(TargetTransformInfo::SK_PermuteTwoSrc, VecTy, Mask);
28152817

28162818
if (OldCost < NewCost)
28172819
return false;

0 commit comments

Comments
 (0)