@@ -421,8 +421,8 @@ bool VectorCombine::isExtractExtractCheap(ExtractElementInst *Ext0,
421421 // Get cost estimates for scalar and vector versions of the operation.
422422 bool IsBinOp = Instruction::isBinaryOp (Opcode);
423423 if (IsBinOp) {
424- ScalarOpCost = TTI.getArithmeticInstrCost (Opcode, ScalarTy);
425- VectorOpCost = TTI.getArithmeticInstrCost (Opcode, VecTy);
424+ ScalarOpCost = TTI.getArithmeticInstrCost (Opcode, ScalarTy, CostKind );
425+ VectorOpCost = TTI.getArithmeticInstrCost (Opcode, VecTy, CostKind );
426426 } else {
427427 assert ((Opcode == Instruction::ICmp || Opcode == Instruction::FCmp) &&
428428 " Expected a compare" );
@@ -684,7 +684,7 @@ bool VectorCombine::foldInsExtFNeg(Instruction &I) {
684684
685685 Type *ScalarTy = VecTy->getScalarType ();
686686 InstructionCost OldCost =
687- TTI.getArithmeticInstrCost (Instruction::FNeg, ScalarTy) +
687+ TTI.getArithmeticInstrCost (Instruction::FNeg, ScalarTy, CostKind ) +
688688 TTI.getVectorInstrCost (I, VecTy, CostKind, Index);
689689
690690 // If the extract has one use, it will be eliminated, so count it in the
@@ -694,7 +694,7 @@ bool VectorCombine::foldInsExtFNeg(Instruction &I) {
694694 OldCost += TTI.getVectorInstrCost (*Extract, VecTy, CostKind, Index);
695695
696696 InstructionCost NewCost =
697- TTI.getArithmeticInstrCost (Instruction::FNeg, VecTy) +
697+ TTI.getArithmeticInstrCost (Instruction::FNeg, VecTy, CostKind ) +
698698 TTI.getShuffleCost (TargetTransformInfo::SK_Select, VecTy, Mask, CostKind);
699699
700700 if (NewCost > OldCost)
@@ -871,8 +871,8 @@ bool VectorCombine::scalarizeVPIntrinsic(Instruction &I) {
871871 IntrinsicCostAttributes Attrs (*ScalarIntrID, VecTy->getScalarType (), Args);
872872 ScalarOpCost = TTI.getIntrinsicInstrCost (Attrs, CostKind);
873873 } else {
874- ScalarOpCost =
875- TTI. getArithmeticInstrCost (*FunctionalOpcode, VecTy->getScalarType ());
874+ ScalarOpCost = TTI. getArithmeticInstrCost (*FunctionalOpcode,
875+ VecTy->getScalarType (), CostKind );
876876 }
877877
878878 // The existing splats may be kept around if other instructions use them.
@@ -995,8 +995,8 @@ bool VectorCombine::scalarizeBinopOrCmp(Instruction &I) {
995995 VectorOpCost = TTI.getCmpSelInstrCost (
996996 Opcode, VecTy, CmpInst::makeCmpResultType (VecTy), Pred);
997997 } else {
998- ScalarOpCost = TTI.getArithmeticInstrCost (Opcode, ScalarTy);
999- VectorOpCost = TTI.getArithmeticInstrCost (Opcode, VecTy);
998+ ScalarOpCost = TTI.getArithmeticInstrCost (Opcode, ScalarTy, CostKind );
999+ VectorOpCost = TTI.getArithmeticInstrCost (Opcode, VecTy, CostKind );
10001000 }
10011001
10021002 // Get cost estimate for the insert element. This cost will factor into
@@ -1101,7 +1101,7 @@ bool VectorCombine::foldExtractedCmps(Instruction &I) {
11011101 TTI.getCmpSelInstrCost (CmpOpcode, I0->getType (),
11021102 CmpInst::makeCmpResultType (I0->getType ()), Pred) *
11031103 2 +
1104- TTI.getArithmeticInstrCost (I.getOpcode (), I.getType ());
1104+ TTI.getArithmeticInstrCost (I.getOpcode (), I.getType (), CostKind );
11051105
11061106 // The proposed vector pattern is:
11071107 // vcmp = cmp Pred X, VecC
@@ -1115,7 +1115,7 @@ bool VectorCombine::foldExtractedCmps(Instruction &I) {
11151115 ShufMask[CheapIndex] = ExpensiveIndex;
11161116 NewCost += TTI.getShuffleCost (TargetTransformInfo::SK_PermuteSingleSrc, CmpTy,
11171117 ShufMask, CostKind);
1118- NewCost += TTI.getArithmeticInstrCost (I.getOpcode (), CmpTy);
1118+ NewCost += TTI.getArithmeticInstrCost (I.getOpcode (), CmpTy, CostKind );
11191119 NewCost += TTI.getVectorInstrCost (*Ext0, CmpTy, CostKind, CheapIndex);
11201120 NewCost += Ext0->hasOneUse () ? 0 : Ext0Cost;
11211121 NewCost += Ext1->hasOneUse () ? 0 : Ext1Cost;
@@ -2616,8 +2616,8 @@ bool VectorCombine::foldSelectShuffle(Instruction &I, bool FromReduction) {
26162616 // Get the costs of the shuffles + binops before and after with the new
26172617 // shuffle masks.
26182618 InstructionCost CostBefore =
2619- TTI.getArithmeticInstrCost (Op0->getOpcode (), VT) +
2620- TTI.getArithmeticInstrCost (Op1->getOpcode (), VT);
2619+ TTI.getArithmeticInstrCost (Op0->getOpcode (), VT, CostKind ) +
2620+ TTI.getArithmeticInstrCost (Op1->getOpcode (), VT, CostKind );
26212621 CostBefore += std::accumulate (Shuffles.begin (), Shuffles.end (),
26222622 InstructionCost (0 ), AddShuffleCost);
26232623 CostBefore += std::accumulate (InputShuffles.begin (), InputShuffles.end (),
@@ -2630,8 +2630,8 @@ bool VectorCombine::foldSelectShuffle(Instruction &I, bool FromReduction) {
26302630 FixedVectorType *Op1SmallVT =
26312631 FixedVectorType::get (VT->getScalarType (), V2.size ());
26322632 InstructionCost CostAfter =
2633- TTI.getArithmeticInstrCost (Op0->getOpcode (), Op0SmallVT) +
2634- TTI.getArithmeticInstrCost (Op1->getOpcode (), Op1SmallVT);
2633+ TTI.getArithmeticInstrCost (Op0->getOpcode (), Op0SmallVT, CostKind ) +
2634+ TTI.getArithmeticInstrCost (Op1->getOpcode (), Op1SmallVT, CostKind );
26352635 CostAfter += std::accumulate (ReconstructMasks.begin (), ReconstructMasks.end (),
26362636 InstructionCost (0 ), AddShuffleMaskCost);
26372637 std::set<SmallVector<int >> OutputShuffleMasks ({V1A, V1B, V2A, V2B});
0 commit comments