@@ -271,7 +271,8 @@ bool VectorCombine::vectorizeLoadInsert(Instruction &I) {
271
271
assert (OffsetEltIndex < MinVecNumElts && " Address offset too big" );
272
272
Mask[0 ] = OffsetEltIndex;
273
273
if (OffsetEltIndex)
274
- NewCost += TTI.getShuffleCost (TTI::SK_PermuteSingleSrc, MinVecTy, Mask);
274
+ NewCost +=
275
+ TTI.getShuffleCost (TTI::SK_PermuteSingleSrc, MinVecTy, Mask, CostKind);
275
276
276
277
// We can aggressively convert to the vector form because the backend can
277
278
// invert this transform if it does not result in a performance win.
@@ -694,7 +695,7 @@ bool VectorCombine::foldInsExtFNeg(Instruction &I) {
694
695
695
696
InstructionCost NewCost =
696
697
TTI.getArithmeticInstrCost (Instruction::FNeg, VecTy) +
697
- TTI.getShuffleCost (TargetTransformInfo::SK_Select, VecTy, Mask);
698
+ TTI.getShuffleCost (TargetTransformInfo::SK_Select, VecTy, Mask, CostKind );
698
699
699
700
if (NewCost > OldCost)
700
701
return false ;
@@ -843,7 +844,8 @@ bool VectorCombine::scalarizeVPIntrinsic(Instruction &I) {
843
844
Mask.resize (FVTy->getNumElements (), 0 );
844
845
InstructionCost SplatCost =
845
846
TTI.getVectorInstrCost (Instruction::InsertElement, VecTy, CostKind, 0 ) +
846
- TTI.getShuffleCost (TargetTransformInfo::SK_Broadcast, VecTy, Mask);
847
+ TTI.getShuffleCost (TargetTransformInfo::SK_Broadcast, VecTy, Mask,
848
+ CostKind);
847
849
848
850
// Calculate the cost of the VP Intrinsic
849
851
SmallVector<Type *, 4 > Args;
@@ -1112,7 +1114,7 @@ bool VectorCombine::foldExtractedCmps(Instruction &I) {
1112
1114
SmallVector<int , 32 > ShufMask (VecTy->getNumElements (), PoisonMaskElem);
1113
1115
ShufMask[CheapIndex] = ExpensiveIndex;
1114
1116
NewCost += TTI.getShuffleCost (TargetTransformInfo::SK_PermuteSingleSrc, CmpTy,
1115
- ShufMask);
1117
+ ShufMask, CostKind );
1116
1118
NewCost += TTI.getArithmeticInstrCost (I.getOpcode (), CmpTy);
1117
1119
NewCost += TTI.getVectorInstrCost (*Ext0, CmpTy, CostKind, CheapIndex);
1118
1120
NewCost += Ext0->hasOneUse () ? 0 : Ext0Cost;
@@ -2288,10 +2290,10 @@ bool VectorCombine::foldShuffleFromReductions(Instruction &I) {
2288
2290
(UsesSecondVec && !IsTruncatingShuffle) ? VecType : ShuffleInputType;
2289
2291
InstructionCost OldCost = TTI.getShuffleCost (
2290
2292
UsesSecondVec ? TTI::SK_PermuteTwoSrc : TTI::SK_PermuteSingleSrc,
2291
- VecTyForCost, Shuffle->getShuffleMask ());
2293
+ VecTyForCost, Shuffle->getShuffleMask (), CostKind );
2292
2294
InstructionCost NewCost = TTI.getShuffleCost (
2293
2295
UsesSecondVec ? TTI::SK_PermuteTwoSrc : TTI::SK_PermuteSingleSrc,
2294
- VecTyForCost, ConcatMask);
2296
+ VecTyForCost, ConcatMask, CostKind );
2295
2297
2296
2298
LLVM_DEBUG (dbgs () << " Found a reduction feeding from a shuffle: " << *Shuffle
2297
2299
<< " \n " );
@@ -2605,10 +2607,10 @@ bool VectorCombine::foldSelectShuffle(Instruction &I, bool FromReduction) {
2605
2607
return C + TTI.getShuffleCost (isa<UndefValue>(SV->getOperand (1 ))
2606
2608
? TTI::SK_PermuteSingleSrc
2607
2609
: TTI::SK_PermuteTwoSrc,
2608
- VT, SV->getShuffleMask ());
2610
+ VT, SV->getShuffleMask (), CostKind );
2609
2611
};
2610
2612
auto AddShuffleMaskCost = [&](InstructionCost C, ArrayRef<int > Mask) {
2611
- return C + TTI.getShuffleCost (TTI::SK_PermuteTwoSrc, VT, Mask);
2613
+ return C + TTI.getShuffleCost (TTI::SK_PermuteTwoSrc, VT, Mask, CostKind );
2612
2614
};
2613
2615
2614
2616
// Get the costs of the shuffles + binops before and after with the new
@@ -2817,8 +2819,8 @@ bool VectorCombine::foldInsExtVectorToShuffle(Instruction &I) {
2817
2819
TTI.getVectorInstrCost (*Ext, VecTy, CostKind, ExtIdx) +
2818
2820
TTI.getVectorInstrCost (*Ins, VecTy, CostKind, InsIdx);
2819
2821
2820
- InstructionCost NewCost =
2821
- TTI. getShuffleCost ( TargetTransformInfo::SK_PermuteTwoSrc, VecTy, Mask);
2822
+ InstructionCost NewCost = TTI. getShuffleCost (
2823
+ TargetTransformInfo::SK_PermuteTwoSrc, VecTy, Mask, CostKind );
2822
2824
if (!Ext->hasOneUse ())
2823
2825
NewCost += TTI.getVectorInstrCost (*Ext, VecTy, CostKind, ExtIdx);
2824
2826
0 commit comments