diff options
Diffstat (limited to 'llvm/lib/CodeGen/SelectOptimize.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectOptimize.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/SelectOptimize.cpp b/llvm/lib/CodeGen/SelectOptimize.cpp index 9c8dcac..b35f765 100644 --- a/llvm/lib/CodeGen/SelectOptimize.cpp +++ b/llvm/lib/CodeGen/SelectOptimize.cpp @@ -978,8 +978,9 @@ void SelectOptimizeImpl::findProfitableSIGroupsInnerLoops( // cost of the most expensive instruction of the group. Scaled64 SelectCost = Scaled64::getZero(), BranchCost = Scaled64::getZero(); for (SelectLike &SI : ASI.Selects) { - SelectCost = std::max(SelectCost, InstCostMap[SI.getI()].PredCost); - BranchCost = std::max(BranchCost, InstCostMap[SI.getI()].NonPredCost); + const auto &ICM = InstCostMap[SI.getI()]; + SelectCost = std::max(SelectCost, ICM.PredCost); + BranchCost = std::max(BranchCost, ICM.NonPredCost); } if (BranchCost < SelectCost) { OptimizationRemark OR(DEBUG_TYPE, "SelectOpti", @@ -1327,8 +1328,8 @@ bool SelectOptimizeImpl::computeLoopCosts( // BranchCost = PredictedPathCost + MispredictCost // PredictedPathCost = TrueOpCost * TrueProb + FalseOpCost * FalseProb // MispredictCost = max(MispredictPenalty, CondCost) * MispredictRate - if (SImap.contains(&I)) { - auto SI = SImap.at(&I); + if (auto It = SImap.find(&I); It != SImap.end()) { + auto SI = It->second; const auto *SG = SGmap.at(&I); Scaled64 TrueOpCost = SI.getOpCostOnBranch(true, InstCostMap, TTI); Scaled64 FalseOpCost = SI.getOpCostOnBranch(false, InstCostMap, TTI); |