Skip to content

Commit 2eea29d

Browse files
committed
Correcting incorrect cost calculation
1 parent f9d0f2f commit 2eea29d

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
@@ -2707,9 +2707,11 @@ bool VectorCombine::foldInsExtVectorToShuffle(Instruction &I) {
27072707

27082708
TTI::TargetCostKind CostKind = TTI::TCK_RecipThroughput;
27092709
InstructionCost OldCost =
2710-
TTI.getVectorInstrCost(*Ext, VecTy, CostKind, ExtIdx);
2710+
TTI.getVectorInstrCost(*Ext, VecTy, CostKind, ExtIdx) +
2711+
TTI.getVectorInstrCost(*Ins, VecTy, CostKind, InsIdx);
2712+
27112713
InstructionCost NewCost =
2712-
TTI.getShuffleCost(TargetTransformInfo::SK_Select, VecTy, Mask);
2714+
TTI.getShuffleCost(TargetTransformInfo::SK_PermuteTwoSrc, VecTy, Mask);
27132715

27142716
if (OldCost < NewCost)
27152717
return false;

0 commit comments

Comments
 (0)