@@ -483,9 +483,9 @@ static Value *getTrueOrFalseValue(
483483 BasicBlock *B) {
484484 Value *V = isTrue ? SI.getTrueValue () : SI.getFalseValue ();
485485 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 ;
489489 return V;
490490 }
491491
@@ -508,9 +508,8 @@ static Value *getTrueOrFalseValue(
508508
509509 unsigned OtherIdx = 1 - CondIdx;
510510 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 );
514513 }
515514 CBO->insertBefore (B->getTerminator ()->getIterator ());
516515 return CBO;
@@ -1305,9 +1304,9 @@ bool SelectOptimizeImpl::computeLoopCosts(
13051304 auto UI = dyn_cast<Instruction>(U.get ());
13061305 if (!UI)
13071306 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 );
13111310 }
13121311 }
13131312 auto ILatency = computeInstCost (&I);
@@ -1338,8 +1337,8 @@ bool SelectOptimizeImpl::computeLoopCosts(
13381337
13391338 Scaled64 CondCost = Scaled64::getZero ();
13401339 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 ;
13431342 Scaled64 MispredictCost = getMispredictionCost (SI, CondCost);
13441343
13451344 INonPredCost = PredictedPathCost + MispredictCost;
0 commit comments