Skip to content

Commit 4c1be42

Browse files
committed
[Analysis] Use the addCost() helper across InlineCost.cpp for consistency sake
1 parent 94213a4 commit 4c1be42

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

llvm/lib/Analysis/InlineCost.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,7 @@ class InlineCostCallAnalyzer final : public CallAnalyzer {
751751
if (CA.analyze().isSuccess()) {
752752
// We were able to inline the indirect call! Subtract the cost from the
753753
// threshold to get the bonus we want to apply, but don't go below zero.
754-
Cost -= std::max(0, CA.getThreshold() - CA.getCost());
754+
addCost(-std::max(0, CA.getThreshold() - CA.getCost()));
755755
}
756756
} else
757757
// Otherwise simply add the cost for merely making the call.
@@ -1191,7 +1191,7 @@ class InlineCostCallAnalyzer final : public CallAnalyzer {
11911191
// If this function uses the coldcc calling convention, prefer not to inline
11921192
// it.
11931193
if (F.getCallingConv() == CallingConv::Cold)
1194-
Cost += InlineConstants::ColdccPenalty;
1194+
addCost(InlineConstants::ColdccPenalty);
11951195

11961196
LLVM_DEBUG(dbgs() << " Initial cost: " << Cost << "\n");
11971197

@@ -2193,7 +2193,7 @@ void InlineCostCallAnalyzer::updateThreshold(CallBase &Call, Function &Callee) {
21932193
// the cost of inlining it drops dramatically. It may seem odd to update
21942194
// Cost in updateThreshold, but the bonus depends on the logic in this method.
21952195
if (isSoleCallToLocalFunction(Call, F)) {
2196-
Cost -= LastCallToStaticBonus;
2196+
addCost(-LastCallToStaticBonus);
21972197
StaticBonusApplied = LastCallToStaticBonus;
21982198
}
21992199
}

0 commit comments

Comments
 (0)