Skip to content

Commit e0ed5e8

Browse files
[Analysis] Avoid repeated hash lookups (NFC) (#127574)
1 parent 7a5d1e9 commit e0ed5e8

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

llvm/lib/Analysis/InlineCost.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -795,17 +795,19 @@ class InlineCostCallAnalyzer final : public CallAnalyzer {
795795
// the given instruction was assessed.
796796
if (!PrintInstructionComments)
797797
return;
798-
InstructionCostDetailMap[I].CostBefore = Cost;
799-
InstructionCostDetailMap[I].ThresholdBefore = Threshold;
798+
auto &CostDetail = InstructionCostDetailMap[I];
799+
CostDetail.CostBefore = Cost;
800+
CostDetail.ThresholdBefore = Threshold;
800801
}
801802

802803
void onInstructionAnalysisFinish(const Instruction *I) override {
803804
// This function is called to find new values of cost and threshold after
804805
// the instruction has been assessed.
805806
if (!PrintInstructionComments)
806807
return;
807-
InstructionCostDetailMap[I].CostAfter = Cost;
808-
InstructionCostDetailMap[I].ThresholdAfter = Threshold;
808+
auto &CostDetail = InstructionCostDetailMap[I];
809+
CostDetail.CostAfter = Cost;
810+
CostDetail.ThresholdAfter = Threshold;
809811
}
810812

811813
bool isCostBenefitAnalysisEnabled() {

0 commit comments

Comments
 (0)