@@ -421,8 +421,8 @@ bool VectorCombine::isExtractExtractCheap(ExtractElementInst *Ext0,
421
421
// Get cost estimates for scalar and vector versions of the operation.
422
422
bool IsBinOp = Instruction::isBinaryOp (Opcode);
423
423
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 );
426
426
} else {
427
427
assert ((Opcode == Instruction::ICmp || Opcode == Instruction::FCmp) &&
428
428
" Expected a compare" );
@@ -684,7 +684,7 @@ bool VectorCombine::foldInsExtFNeg(Instruction &I) {
684
684
685
685
Type *ScalarTy = VecTy->getScalarType ();
686
686
InstructionCost OldCost =
687
- TTI.getArithmeticInstrCost (Instruction::FNeg, ScalarTy) +
687
+ TTI.getArithmeticInstrCost (Instruction::FNeg, ScalarTy, CostKind ) +
688
688
TTI.getVectorInstrCost (I, VecTy, CostKind, Index);
689
689
690
690
// If the extract has one use, it will be eliminated, so count it in the
@@ -694,7 +694,7 @@ bool VectorCombine::foldInsExtFNeg(Instruction &I) {
694
694
OldCost += TTI.getVectorInstrCost (*Extract, VecTy, CostKind, Index);
695
695
696
696
InstructionCost NewCost =
697
- TTI.getArithmeticInstrCost (Instruction::FNeg, VecTy) +
697
+ TTI.getArithmeticInstrCost (Instruction::FNeg, VecTy, CostKind ) +
698
698
TTI.getShuffleCost (TargetTransformInfo::SK_Select, VecTy, Mask, CostKind);
699
699
700
700
if (NewCost > OldCost)
@@ -871,8 +871,8 @@ bool VectorCombine::scalarizeVPIntrinsic(Instruction &I) {
871
871
IntrinsicCostAttributes Attrs (*ScalarIntrID, VecTy->getScalarType (), Args);
872
872
ScalarOpCost = TTI.getIntrinsicInstrCost (Attrs, CostKind);
873
873
} else {
874
- ScalarOpCost =
875
- TTI. getArithmeticInstrCost (*FunctionalOpcode, VecTy->getScalarType ());
874
+ ScalarOpCost = TTI. getArithmeticInstrCost (*FunctionalOpcode,
875
+ VecTy->getScalarType (), CostKind );
876
876
}
877
877
878
878
// The existing splats may be kept around if other instructions use them.
@@ -995,8 +995,8 @@ bool VectorCombine::scalarizeBinopOrCmp(Instruction &I) {
995
995
VectorOpCost = TTI.getCmpSelInstrCost (
996
996
Opcode, VecTy, CmpInst::makeCmpResultType (VecTy), Pred);
997
997
} 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 );
1000
1000
}
1001
1001
1002
1002
// Get cost estimate for the insert element. This cost will factor into
@@ -1101,7 +1101,7 @@ bool VectorCombine::foldExtractedCmps(Instruction &I) {
1101
1101
TTI.getCmpSelInstrCost (CmpOpcode, I0->getType (),
1102
1102
CmpInst::makeCmpResultType (I0->getType ()), Pred) *
1103
1103
2 +
1104
- TTI.getArithmeticInstrCost (I.getOpcode (), I.getType ());
1104
+ TTI.getArithmeticInstrCost (I.getOpcode (), I.getType (), CostKind );
1105
1105
1106
1106
// The proposed vector pattern is:
1107
1107
// vcmp = cmp Pred X, VecC
@@ -1115,7 +1115,7 @@ bool VectorCombine::foldExtractedCmps(Instruction &I) {
1115
1115
ShufMask[CheapIndex] = ExpensiveIndex;
1116
1116
NewCost += TTI.getShuffleCost (TargetTransformInfo::SK_PermuteSingleSrc, CmpTy,
1117
1117
ShufMask, CostKind);
1118
- NewCost += TTI.getArithmeticInstrCost (I.getOpcode (), CmpTy);
1118
+ NewCost += TTI.getArithmeticInstrCost (I.getOpcode (), CmpTy, CostKind );
1119
1119
NewCost += TTI.getVectorInstrCost (*Ext0, CmpTy, CostKind, CheapIndex);
1120
1120
NewCost += Ext0->hasOneUse () ? 0 : Ext0Cost;
1121
1121
NewCost += Ext1->hasOneUse () ? 0 : Ext1Cost;
@@ -2616,8 +2616,8 @@ bool VectorCombine::foldSelectShuffle(Instruction &I, bool FromReduction) {
2616
2616
// Get the costs of the shuffles + binops before and after with the new
2617
2617
// shuffle masks.
2618
2618
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 );
2621
2621
CostBefore += std::accumulate (Shuffles.begin (), Shuffles.end (),
2622
2622
InstructionCost (0 ), AddShuffleCost);
2623
2623
CostBefore += std::accumulate (InputShuffles.begin (), InputShuffles.end (),
@@ -2630,8 +2630,8 @@ bool VectorCombine::foldSelectShuffle(Instruction &I, bool FromReduction) {
2630
2630
FixedVectorType *Op1SmallVT =
2631
2631
FixedVectorType::get (VT->getScalarType (), V2.size ());
2632
2632
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 );
2635
2635
CostAfter += std::accumulate (ReconstructMasks.begin (), ReconstructMasks.end (),
2636
2636
InstructionCost (0 ), AddShuffleMaskCost);
2637
2637
std::set<SmallVector<int >> OutputShuffleMasks ({V1A, V1B, V2A, V2B});
0 commit comments