@@ -1105,7 +1105,7 @@ class LoopVectorizationCostModel {
1105
1105
void setWideningDecision (Instruction *I, ElementCount VF, InstWidening W,
1106
1106
InstructionCost Cost) {
1107
1107
assert (VF.isVector () && " Expected VF >=2" );
1108
- WideningDecisions[std::make_pair ( I, VF) ] = std::make_pair ( W, Cost) ;
1108
+ WideningDecisions[{ I, VF} ] = { W, Cost} ;
1109
1109
}
1110
1110
1111
1111
// / Save vectorization decision \p W and \p Cost taken by the cost model for
@@ -1127,11 +1127,9 @@ class LoopVectorizationCostModel {
1127
1127
for (unsigned Idx = 0 ; Idx < Grp->getFactor (); ++Idx) {
1128
1128
if (auto *I = Grp->getMember (Idx)) {
1129
1129
if (Grp->getInsertPos () == I)
1130
- WideningDecisions[std::make_pair (I, VF)] =
1131
- std::make_pair (W, InsertPosCost);
1130
+ WideningDecisions[{I, VF}] = {W, InsertPosCost};
1132
1131
else
1133
- WideningDecisions[std::make_pair (I, VF)] =
1134
- std::make_pair (W, OtherMemberCost);
1132
+ WideningDecisions[{I, VF}] = {W, OtherMemberCost};
1135
1133
}
1136
1134
}
1137
1135
}
@@ -1145,7 +1143,7 @@ class LoopVectorizationCostModel {
1145
1143
TheLoop->isInnermost () &&
1146
1144
" cost-model should not be used for outer loops (in VPlan-native path)" );
1147
1145
1148
- std::pair<Instruction *, ElementCount> InstOnVF = std::make_pair (I, VF);
1146
+ std::pair<Instruction *, ElementCount> InstOnVF (I, VF);
1149
1147
auto Itr = WideningDecisions.find (InstOnVF);
1150
1148
if (Itr == WideningDecisions.end ())
1151
1149
return CM_Unknown;
@@ -1156,7 +1154,7 @@ class LoopVectorizationCostModel {
1156
1154
// / width \p VF.
1157
1155
InstructionCost getWideningCost (Instruction *I, ElementCount VF) {
1158
1156
assert (VF.isVector () && " Expected VF >=2" );
1159
- std::pair<Instruction *, ElementCount> InstOnVF = std::make_pair (I, VF);
1157
+ std::pair<Instruction *, ElementCount> InstOnVF (I, VF);
1160
1158
assert (WideningDecisions.contains (InstOnVF) &&
1161
1159
" The cost is not calculated" );
1162
1160
return WideningDecisions[InstOnVF].second ;
@@ -1175,8 +1173,7 @@ class LoopVectorizationCostModel {
1175
1173
std::optional<unsigned > MaskPos,
1176
1174
InstructionCost Cost) {
1177
1175
assert (!VF.isScalar () && " Expected vector VF" );
1178
- CallWideningDecisions[std::make_pair (CI, VF)] = {Kind, Variant, IID,
1179
- MaskPos, Cost};
1176
+ CallWideningDecisions[{CI, VF}] = {Kind, Variant, IID, MaskPos, Cost};
1180
1177
}
1181
1178
1182
1179
CallWideningDecision getCallWideningDecision (CallInst *CI,
@@ -1373,21 +1370,20 @@ class LoopVectorizationCostModel {
1373
1370
void setTailFoldingStyles (bool IsScalableVF, unsigned UserIC) {
1374
1371
assert (!ChosenTailFoldingStyle && " Tail folding must not be selected yet." );
1375
1372
if (!Legal->canFoldTailByMasking ()) {
1376
- ChosenTailFoldingStyle =
1377
- std::make_pair (TailFoldingStyle::None, TailFoldingStyle::None);
1373
+ ChosenTailFoldingStyle = {TailFoldingStyle::None, TailFoldingStyle::None};
1378
1374
return ;
1379
1375
}
1380
1376
1381
1377
if (!ForceTailFoldingStyle.getNumOccurrences ()) {
1382
- ChosenTailFoldingStyle = std::make_pair (
1378
+ ChosenTailFoldingStyle = {
1383
1379
TTI.getPreferredTailFoldingStyle (/* IVUpdateMayOverflow=*/ true ),
1384
- TTI.getPreferredTailFoldingStyle (/* IVUpdateMayOverflow=*/ false )) ;
1380
+ TTI.getPreferredTailFoldingStyle (/* IVUpdateMayOverflow=*/ false )} ;
1385
1381
return ;
1386
1382
}
1387
1383
1388
1384
// Set styles when forced.
1389
- ChosenTailFoldingStyle = std::make_pair ( ForceTailFoldingStyle.getValue (),
1390
- ForceTailFoldingStyle.getValue ()) ;
1385
+ ChosenTailFoldingStyle = { ForceTailFoldingStyle.getValue (),
1386
+ ForceTailFoldingStyle.getValue ()} ;
1391
1387
if (ForceTailFoldingStyle != TailFoldingStyle::DataWithEVL)
1392
1388
return ;
1393
1389
// Override forced styles if needed.
@@ -1400,9 +1396,8 @@ class LoopVectorizationCostModel {
1400
1396
// If for some reason EVL mode is unsupported, fallback to
1401
1397
// DataWithoutLaneMask to try to vectorize the loop with folded tail
1402
1398
// in a generic way.
1403
- ChosenTailFoldingStyle =
1404
- std::make_pair (TailFoldingStyle::DataWithoutLaneMask,
1405
- TailFoldingStyle::DataWithoutLaneMask);
1399
+ ChosenTailFoldingStyle = {TailFoldingStyle::DataWithoutLaneMask,
1400
+ TailFoldingStyle::DataWithoutLaneMask};
1406
1401
LLVM_DEBUG (
1407
1402
dbgs ()
1408
1403
<< " LV: Preference for VP intrinsics indicated. Will "
@@ -8491,7 +8486,7 @@ void VPRecipeBuilder::collectScaledReductions(VFRange &Range) {
8491
8486
PartialReductionChain Chain = Pair.first ;
8492
8487
if (ExtendIsOnlyUsedByPartialReductions (Chain.ExtendA ) &&
8493
8488
ExtendIsOnlyUsedByPartialReductions (Chain.ExtendB ))
8494
- ScaledReductionMap.insert ( std::make_pair ( Chain.Reduction , Pair.second ) );
8489
+ ScaledReductionMap.emplace_or_assign ( Chain.Reduction , Pair.second );
8495
8490
}
8496
8491
}
8497
8492
@@ -8563,12 +8558,11 @@ bool VPRecipeBuilder::getScaledReductions(
8563
8558
[&](ElementCount VF) {
8564
8559
InstructionCost Cost = TTI->getPartialReductionCost (
8565
8560
Update->getOpcode (), A->getType (), B->getType (), PHI->getType (),
8566
- VF, OpAExtend, OpBExtend,
8567
- std::make_optional (BinOp->getOpcode ()));
8561
+ VF, OpAExtend, OpBExtend, BinOp->getOpcode ());
8568
8562
return Cost.isValid ();
8569
8563
},
8570
8564
Range)) {
8571
- Chains.push_back ( std::make_pair ( Chain, TargetScaleFactor) );
8565
+ Chains.emplace_back ( Chain, TargetScaleFactor);
8572
8566
return true ;
8573
8567
}
8574
8568
@@ -10418,9 +10412,9 @@ bool LoopVectorizePass::processLoop(Loop *L) {
10418
10412
bool VectorizeLoop = true , InterleaveLoop = true ;
10419
10413
if (VF.Width .isScalar ()) {
10420
10414
LLVM_DEBUG (dbgs () << " LV: Vectorization is possible but not beneficial.\n " );
10421
- VecDiagMsg = std::make_pair (
10415
+ VecDiagMsg = {
10422
10416
" VectorizationNotBeneficial" ,
10423
- " the cost-model indicates that vectorization is not beneficial" ) ;
10417
+ " the cost-model indicates that vectorization is not beneficial" } ;
10424
10418
VectorizeLoop = false ;
10425
10419
}
10426
10420
@@ -10429,16 +10423,15 @@ bool LoopVectorizePass::processLoop(Loop *L) {
10429
10423
// requested.
10430
10424
LLVM_DEBUG (dbgs () << " LV: Ignoring UserIC, because vectorization and "
10431
10425
" interleaving should be avoided up front\n " );
10432
- IntDiagMsg = std::make_pair (
10433
- " InterleavingAvoided" ,
10434
- " Ignoring UserIC, because interleaving was avoided up front" );
10426
+ IntDiagMsg = {" InterleavingAvoided" ,
10427
+ " Ignoring UserIC, because interleaving was avoided up front" };
10435
10428
InterleaveLoop = false ;
10436
10429
} else if (IC == 1 && UserIC <= 1 ) {
10437
10430
// Tell the user interleaving is not beneficial.
10438
10431
LLVM_DEBUG (dbgs () << " LV: Interleaving is not beneficial.\n " );
10439
- IntDiagMsg = std::make_pair (
10432
+ IntDiagMsg = {
10440
10433
" InterleavingNotBeneficial" ,
10441
- " the cost-model indicates that interleaving is not beneficial" ) ;
10434
+ " the cost-model indicates that interleaving is not beneficial" } ;
10442
10435
InterleaveLoop = false ;
10443
10436
if (UserIC == 1 ) {
10444
10437
IntDiagMsg.first = " InterleavingNotBeneficialAndDisabled" ;
@@ -10449,10 +10442,9 @@ bool LoopVectorizePass::processLoop(Loop *L) {
10449
10442
// Tell the user interleaving is beneficial, but it explicitly disabled.
10450
10443
LLVM_DEBUG (
10451
10444
dbgs () << " LV: Interleaving is beneficial but is explicitly disabled." );
10452
- IntDiagMsg = std::make_pair (
10453
- " InterleavingBeneficialButDisabled" ,
10454
- " the cost-model indicates that interleaving is beneficial "
10455
- " but is explicitly disabled or interleave count is set to 1" );
10445
+ IntDiagMsg = {" InterleavingBeneficialButDisabled" ,
10446
+ " the cost-model indicates that interleaving is beneficial "
10447
+ " but is explicitly disabled or interleave count is set to 1" };
10456
10448
InterleaveLoop = false ;
10457
10449
}
10458
10450
@@ -10462,10 +10454,10 @@ bool LoopVectorizePass::processLoop(Loop *L) {
10462
10454
if (!VectorizeLoop && InterleaveLoop && LVL.hasHistograms ()) {
10463
10455
LLVM_DEBUG (dbgs () << " LV: Not interleaving without vectorization due "
10464
10456
<< " to histogram operations.\n " );
10465
- IntDiagMsg = std::make_pair (
10457
+ IntDiagMsg = {
10466
10458
" HistogramPreventsScalarInterleaving" ,
10467
10459
" Unable to interleave without vectorization due to constraints on "
10468
- " the order of histogram operations" ) ;
10460
+ " the order of histogram operations" } ;
10469
10461
InterleaveLoop = false ;
10470
10462
}
10471
10463
0 commit comments