@@ -271,7 +271,8 @@ bool VectorCombine::vectorizeLoadInsert(Instruction &I) {
271271 assert (OffsetEltIndex < MinVecNumElts && " Address offset too big" );
272272 Mask[0 ] = OffsetEltIndex;
273273 if (OffsetEltIndex)
274- NewCost += TTI.getShuffleCost (TTI::SK_PermuteSingleSrc, MinVecTy, Mask);
274+ NewCost +=
275+ TTI.getShuffleCost (TTI::SK_PermuteSingleSrc, MinVecTy, Mask, CostKind);
275276
276277 // We can aggressively convert to the vector form because the backend can
277278 // invert this transform if it does not result in a performance win.
@@ -694,7 +695,7 @@ bool VectorCombine::foldInsExtFNeg(Instruction &I) {
694695
695696 InstructionCost NewCost =
696697 TTI.getArithmeticInstrCost (Instruction::FNeg, VecTy) +
697- TTI.getShuffleCost (TargetTransformInfo::SK_Select, VecTy, Mask);
698+ TTI.getShuffleCost (TargetTransformInfo::SK_Select, VecTy, Mask, CostKind );
698699
699700 if (NewCost > OldCost)
700701 return false ;
@@ -843,7 +844,8 @@ bool VectorCombine::scalarizeVPIntrinsic(Instruction &I) {
843844 Mask.resize (FVTy->getNumElements (), 0 );
844845 InstructionCost SplatCost =
845846 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);
847849
848850 // Calculate the cost of the VP Intrinsic
849851 SmallVector<Type *, 4 > Args;
@@ -1112,7 +1114,7 @@ bool VectorCombine::foldExtractedCmps(Instruction &I) {
11121114 SmallVector<int , 32 > ShufMask (VecTy->getNumElements (), PoisonMaskElem);
11131115 ShufMask[CheapIndex] = ExpensiveIndex;
11141116 NewCost += TTI.getShuffleCost (TargetTransformInfo::SK_PermuteSingleSrc, CmpTy,
1115- ShufMask);
1117+ ShufMask, CostKind );
11161118 NewCost += TTI.getArithmeticInstrCost (I.getOpcode (), CmpTy);
11171119 NewCost += TTI.getVectorInstrCost (*Ext0, CmpTy, CostKind, CheapIndex);
11181120 NewCost += Ext0->hasOneUse () ? 0 : Ext0Cost;
@@ -2288,10 +2290,10 @@ bool VectorCombine::foldShuffleFromReductions(Instruction &I) {
22882290 (UsesSecondVec && !IsTruncatingShuffle) ? VecType : ShuffleInputType;
22892291 InstructionCost OldCost = TTI.getShuffleCost (
22902292 UsesSecondVec ? TTI::SK_PermuteTwoSrc : TTI::SK_PermuteSingleSrc,
2291- VecTyForCost, Shuffle->getShuffleMask ());
2293+ VecTyForCost, Shuffle->getShuffleMask (), CostKind );
22922294 InstructionCost NewCost = TTI.getShuffleCost (
22932295 UsesSecondVec ? TTI::SK_PermuteTwoSrc : TTI::SK_PermuteSingleSrc,
2294- VecTyForCost, ConcatMask);
2296+ VecTyForCost, ConcatMask, CostKind );
22952297
22962298 LLVM_DEBUG (dbgs () << " Found a reduction feeding from a shuffle: " << *Shuffle
22972299 << " \n " );
@@ -2605,10 +2607,10 @@ bool VectorCombine::foldSelectShuffle(Instruction &I, bool FromReduction) {
26052607 return C + TTI.getShuffleCost (isa<UndefValue>(SV->getOperand (1 ))
26062608 ? TTI::SK_PermuteSingleSrc
26072609 : TTI::SK_PermuteTwoSrc,
2608- VT, SV->getShuffleMask ());
2610+ VT, SV->getShuffleMask (), CostKind );
26092611 };
26102612 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 );
26122614 };
26132615
26142616 // Get the costs of the shuffles + binops before and after with the new
@@ -2817,8 +2819,8 @@ bool VectorCombine::foldInsExtVectorToShuffle(Instruction &I) {
28172819 TTI.getVectorInstrCost (*Ext, VecTy, CostKind, ExtIdx) +
28182820 TTI.getVectorInstrCost (*Ins, VecTy, CostKind, InsIdx);
28192821
2820- InstructionCost NewCost =
2821- TTI. getShuffleCost ( TargetTransformInfo::SK_PermuteTwoSrc, VecTy, Mask);
2822+ InstructionCost NewCost = TTI. getShuffleCost (
2823+ TargetTransformInfo::SK_PermuteTwoSrc, VecTy, Mask, CostKind );
28222824 if (!Ext->hasOneUse ())
28232825 NewCost += TTI.getVectorInstrCost (*Ext, VecTy, CostKind, ExtIdx);
28242826
0 commit comments