@@ -1080,7 +1080,7 @@ class LoopVectorizationCostModel {
1080
1080
void setWideningDecision (Instruction *I, ElementCount VF, InstWidening W,
1081
1081
InstructionCost Cost) {
1082
1082
assert (VF.isVector () && " Expected VF >=2" );
1083
- WideningDecisions[std::make_pair ( I, VF) ] = std::make_pair ( W, Cost) ;
1083
+ WideningDecisions[{ I, VF} ] = { W, Cost} ;
1084
1084
}
1085
1085
1086
1086
// / Save vectorization decision \p W and \p Cost taken by the cost model for
@@ -1102,11 +1102,9 @@ class LoopVectorizationCostModel {
1102
1102
for (unsigned Idx = 0 ; Idx < Grp->getFactor (); ++Idx) {
1103
1103
if (auto *I = Grp->getMember (Idx)) {
1104
1104
if (Grp->getInsertPos () == I)
1105
- WideningDecisions[std::make_pair (I, VF)] =
1106
- std::make_pair (W, InsertPosCost);
1105
+ WideningDecisions[{I, VF}] = {W, InsertPosCost};
1107
1106
else
1108
- WideningDecisions[std::make_pair (I, VF)] =
1109
- std::make_pair (W, OtherMemberCost);
1107
+ WideningDecisions[{I, VF}] = {W, OtherMemberCost};
1110
1108
}
1111
1109
}
1112
1110
}
@@ -1120,7 +1118,7 @@ class LoopVectorizationCostModel {
1120
1118
TheLoop->isInnermost () &&
1121
1119
" cost-model should not be used for outer loops (in VPlan-native path)" );
1122
1120
1123
- std::pair<Instruction *, ElementCount> InstOnVF = std::make_pair (I, VF);
1121
+ std::pair<Instruction *, ElementCount> InstOnVF (I, VF);
1124
1122
auto Itr = WideningDecisions.find (InstOnVF);
1125
1123
if (Itr == WideningDecisions.end ())
1126
1124
return CM_Unknown;
@@ -1131,7 +1129,7 @@ class LoopVectorizationCostModel {
1131
1129
// / width \p VF.
1132
1130
InstructionCost getWideningCost (Instruction *I, ElementCount VF) {
1133
1131
assert (VF.isVector () && " Expected VF >=2" );
1134
- std::pair<Instruction *, ElementCount> InstOnVF = std::make_pair (I, VF);
1132
+ std::pair<Instruction *, ElementCount> InstOnVF (I, VF);
1135
1133
assert (WideningDecisions.contains (InstOnVF) &&
1136
1134
" The cost is not calculated" );
1137
1135
return WideningDecisions[InstOnVF].second ;
@@ -1150,8 +1148,7 @@ class LoopVectorizationCostModel {
1150
1148
std::optional<unsigned > MaskPos,
1151
1149
InstructionCost Cost) {
1152
1150
assert (!VF.isScalar () && " Expected vector VF" );
1153
- CallWideningDecisions[std::make_pair (CI, VF)] = {Kind, Variant, IID,
1154
- MaskPos, Cost};
1151
+ CallWideningDecisions[{CI, VF}] = {Kind, Variant, IID, MaskPos, Cost};
1155
1152
}
1156
1153
1157
1154
CallWideningDecision getCallWideningDecision (CallInst *CI,
@@ -1348,21 +1345,20 @@ class LoopVectorizationCostModel {
1348
1345
void setTailFoldingStyles (bool IsScalableVF, unsigned UserIC) {
1349
1346
assert (!ChosenTailFoldingStyle && " Tail folding must not be selected yet." );
1350
1347
if (!Legal->canFoldTailByMasking ()) {
1351
- ChosenTailFoldingStyle =
1352
- std::make_pair (TailFoldingStyle::None, TailFoldingStyle::None);
1348
+ ChosenTailFoldingStyle = {TailFoldingStyle::None, TailFoldingStyle::None};
1353
1349
return ;
1354
1350
}
1355
1351
1356
1352
if (!ForceTailFoldingStyle.getNumOccurrences ()) {
1357
- ChosenTailFoldingStyle = std::make_pair (
1353
+ ChosenTailFoldingStyle = {
1358
1354
TTI.getPreferredTailFoldingStyle (/* IVUpdateMayOverflow=*/ true ),
1359
- TTI.getPreferredTailFoldingStyle (/* IVUpdateMayOverflow=*/ false )) ;
1355
+ TTI.getPreferredTailFoldingStyle (/* IVUpdateMayOverflow=*/ false )} ;
1360
1356
return ;
1361
1357
}
1362
1358
1363
1359
// Set styles when forced.
1364
- ChosenTailFoldingStyle = std::make_pair ( ForceTailFoldingStyle.getValue (),
1365
- ForceTailFoldingStyle.getValue ()) ;
1360
+ ChosenTailFoldingStyle = { ForceTailFoldingStyle.getValue (),
1361
+ ForceTailFoldingStyle.getValue ()} ;
1366
1362
if (ForceTailFoldingStyle != TailFoldingStyle::DataWithEVL)
1367
1363
return ;
1368
1364
// Override forced styles if needed.
@@ -1375,9 +1371,8 @@ class LoopVectorizationCostModel {
1375
1371
// If for some reason EVL mode is unsupported, fallback to
1376
1372
// DataWithoutLaneMask to try to vectorize the loop with folded tail
1377
1373
// in a generic way.
1378
- ChosenTailFoldingStyle =
1379
- std::make_pair (TailFoldingStyle::DataWithoutLaneMask,
1380
- TailFoldingStyle::DataWithoutLaneMask);
1374
+ ChosenTailFoldingStyle = {TailFoldingStyle::DataWithoutLaneMask,
1375
+ TailFoldingStyle::DataWithoutLaneMask};
1381
1376
LLVM_DEBUG (
1382
1377
dbgs ()
1383
1378
<< " LV: Preference for VP intrinsics indicated. Will "
@@ -8138,7 +8133,7 @@ void VPRecipeBuilder::collectScaledReductions(VFRange &Range) {
8138
8133
PartialReductionChain Chain = Pair.first ;
8139
8134
if (ExtendIsOnlyUsedByPartialReductions (Chain.ExtendA ) &&
8140
8135
ExtendIsOnlyUsedByPartialReductions (Chain.ExtendB ))
8141
- ScaledReductionMap.insert ( std::make_pair ( Chain.Reduction , Pair.second ) );
8136
+ ScaledReductionMap.try_emplace ( Chain.Reduction , Pair.second );
8142
8137
}
8143
8138
}
8144
8139
@@ -8210,12 +8205,11 @@ bool VPRecipeBuilder::getScaledReductions(
8210
8205
[&](ElementCount VF) {
8211
8206
InstructionCost Cost = TTI->getPartialReductionCost (
8212
8207
Update->getOpcode (), A->getType (), B->getType (), PHI->getType (),
8213
- VF, OpAExtend, OpBExtend,
8214
- std::make_optional (BinOp->getOpcode ()));
8208
+ VF, OpAExtend, OpBExtend, BinOp->getOpcode ());
8215
8209
return Cost.isValid ();
8216
8210
},
8217
8211
Range)) {
8218
- Chains.push_back ( std::make_pair ( Chain, TargetScaleFactor) );
8212
+ Chains.emplace_back ( Chain, TargetScaleFactor);
8219
8213
return true ;
8220
8214
}
8221
8215
@@ -10108,9 +10102,9 @@ bool LoopVectorizePass::processLoop(Loop *L) {
10108
10102
bool VectorizeLoop = true , InterleaveLoop = true ;
10109
10103
if (VF.Width .isScalar ()) {
10110
10104
LLVM_DEBUG (dbgs () << " LV: Vectorization is possible but not beneficial.\n " );
10111
- VecDiagMsg = std::make_pair (
10105
+ VecDiagMsg = {
10112
10106
" VectorizationNotBeneficial" ,
10113
- " the cost-model indicates that vectorization is not beneficial" ) ;
10107
+ " the cost-model indicates that vectorization is not beneficial" } ;
10114
10108
VectorizeLoop = false ;
10115
10109
}
10116
10110
@@ -10119,16 +10113,15 @@ bool LoopVectorizePass::processLoop(Loop *L) {
10119
10113
// requested.
10120
10114
LLVM_DEBUG (dbgs () << " LV: Ignoring UserIC, because vectorization and "
10121
10115
" interleaving should be avoided up front\n " );
10122
- IntDiagMsg = std::make_pair (
10123
- " InterleavingAvoided" ,
10124
- " Ignoring UserIC, because interleaving was avoided up front" );
10116
+ IntDiagMsg = {" InterleavingAvoided" ,
10117
+ " Ignoring UserIC, because interleaving was avoided up front" };
10125
10118
InterleaveLoop = false ;
10126
10119
} else if (IC == 1 && UserIC <= 1 ) {
10127
10120
// Tell the user interleaving is not beneficial.
10128
10121
LLVM_DEBUG (dbgs () << " LV: Interleaving is not beneficial.\n " );
10129
- IntDiagMsg = std::make_pair (
10122
+ IntDiagMsg = {
10130
10123
" InterleavingNotBeneficial" ,
10131
- " the cost-model indicates that interleaving is not beneficial" ) ;
10124
+ " the cost-model indicates that interleaving is not beneficial" } ;
10132
10125
InterleaveLoop = false ;
10133
10126
if (UserIC == 1 ) {
10134
10127
IntDiagMsg.first = " InterleavingNotBeneficialAndDisabled" ;
@@ -10139,10 +10132,9 @@ bool LoopVectorizePass::processLoop(Loop *L) {
10139
10132
// Tell the user interleaving is beneficial, but it explicitly disabled.
10140
10133
LLVM_DEBUG (
10141
10134
dbgs () << " LV: Interleaving is beneficial but is explicitly disabled." );
10142
- IntDiagMsg = std::make_pair (
10143
- " InterleavingBeneficialButDisabled" ,
10144
- " the cost-model indicates that interleaving is beneficial "
10145
- " but is explicitly disabled or interleave count is set to 1" );
10135
+ IntDiagMsg = {" InterleavingBeneficialButDisabled" ,
10136
+ " the cost-model indicates that interleaving is beneficial "
10137
+ " but is explicitly disabled or interleave count is set to 1" };
10146
10138
InterleaveLoop = false ;
10147
10139
}
10148
10140
@@ -10152,10 +10144,10 @@ bool LoopVectorizePass::processLoop(Loop *L) {
10152
10144
if (!VectorizeLoop && InterleaveLoop && LVL.hasHistograms ()) {
10153
10145
LLVM_DEBUG (dbgs () << " LV: Not interleaving without vectorization due "
10154
10146
<< " to histogram operations.\n " );
10155
- IntDiagMsg = std::make_pair (
10147
+ IntDiagMsg = {
10156
10148
" HistogramPreventsScalarInterleaving" ,
10157
10149
" Unable to interleave without vectorization due to constraints on "
10158
- " the order of histogram operations" ) ;
10150
+ " the order of histogram operations" } ;
10159
10151
InterleaveLoop = false ;
10160
10152
}
10161
10153
0 commit comments