@@ -483,9 +483,9 @@ static Value *getTrueOrFalseValue(
483
483
BasicBlock *B) {
484
484
Value *V = isTrue ? SI.getTrueValue () : SI.getFalseValue ();
485
485
if (V) {
486
- auto *IV = dyn_cast<Instruction>(V);
487
- if (IV && OptSelects.count (IV))
488
- return isTrue ? OptSelects[IV] .first : OptSelects[IV] .second ;
486
+ if ( auto *IV = dyn_cast<Instruction>(V))
487
+ if (auto It = OptSelects.find (IV); It != OptSelects. end ( ))
488
+ return isTrue ? It-> second .first : It-> second .second ;
489
489
return V;
490
490
}
491
491
@@ -508,9 +508,8 @@ static Value *getTrueOrFalseValue(
508
508
509
509
unsigned OtherIdx = 1 - CondIdx;
510
510
if (auto *IV = dyn_cast<Instruction>(CBO->getOperand (OtherIdx))) {
511
- if (OptSelects.count (IV))
512
- CBO->setOperand (OtherIdx,
513
- isTrue ? OptSelects[IV].first : OptSelects[IV].second );
511
+ if (auto It = OptSelects.find (IV); It != OptSelects.end ())
512
+ CBO->setOperand (OtherIdx, isTrue ? It->second .first : It->second .second );
514
513
}
515
514
CBO->insertBefore (B->getTerminator ()->getIterator ());
516
515
return CBO;
@@ -1305,9 +1304,9 @@ bool SelectOptimizeImpl::computeLoopCosts(
1305
1304
auto UI = dyn_cast<Instruction>(U.get ());
1306
1305
if (!UI)
1307
1306
continue ;
1308
- if (InstCostMap.count (UI)) {
1309
- IPredCost = std::max (IPredCost, InstCostMap[UI] .PredCost );
1310
- INonPredCost = std::max (INonPredCost, InstCostMap[UI] .NonPredCost );
1307
+ if (auto It = InstCostMap.find (UI); It != InstCostMap. end ( )) {
1308
+ IPredCost = std::max (IPredCost, It-> second .PredCost );
1309
+ INonPredCost = std::max (INonPredCost, It-> second .NonPredCost );
1311
1310
}
1312
1311
}
1313
1312
auto ILatency = computeInstCost (&I);
@@ -1338,8 +1337,8 @@ bool SelectOptimizeImpl::computeLoopCosts(
1338
1337
1339
1338
Scaled64 CondCost = Scaled64::getZero ();
1340
1339
if (auto *CI = dyn_cast<Instruction>(SG->Condition ))
1341
- if (InstCostMap.count (CI))
1342
- CondCost = InstCostMap[CI] .NonPredCost ;
1340
+ if (auto It = InstCostMap.find (CI); It != InstCostMap. end ( ))
1341
+ CondCost = It-> second .NonPredCost ;
1343
1342
Scaled64 MispredictCost = getMispredictionCost (SI, CondCost);
1344
1343
1345
1344
INonPredCost = PredictedPathCost + MispredictCost;
0 commit comments