[PATCH] D105362: [NFC] Code cleanups in InlineCost.cpp.
Jacob Hegna via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 16 14:27:59 PDT 2021
jacobhegna updated this revision to Diff 359453.
jacobhegna edited the summary of this revision.
jacobhegna added a comment.
Remove std::numeric_limits<int>::max() changes.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D105362/new/
https://reviews.llvm.org/D105362
Files:
llvm/lib/Analysis/InlineCost.cpp
Index: llvm/lib/Analysis/InlineCost.cpp
===================================================================
--- llvm/lib/Analysis/InlineCost.cpp
+++ llvm/lib/Analysis/InlineCost.cpp
@@ -534,7 +534,7 @@
/// Handle a capped 'int' increment for Cost.
void addCost(int64_t Inc, int64_t UpperBound = INT_MAX) {
assert(UpperBound > 0 && UpperBound <= INT_MAX && "invalid upper bound");
- Cost = (int)std::min(UpperBound, Cost + Inc);
+ Cost = std::min<int>(UpperBound, Cost + Inc);
}
void onDisableSROA(AllocaInst *Arg) override {
@@ -595,10 +595,11 @@
// branch to destination.
// Maximum valid cost increased in this function.
if (JumpTableSize) {
- int64_t JTCost = (int64_t)JumpTableSize * InlineConstants::InstrCost +
- 4 * InlineConstants::InstrCost;
+ int64_t JTCost =
+ static_cast<int64_t>(JumpTableSize) * InlineConstants::InstrCost +
+ 4 * InlineConstants::InstrCost;
- addCost(JTCost, (int64_t)CostUpperBound);
+ addCost(JTCost, static_cast<int64_t>(CostUpperBound));
return;
}
@@ -613,7 +614,7 @@
int64_t SwitchCost =
ExpectedNumberOfCompare * 2 * InlineConstants::InstrCost;
- addCost(SwitchCost, (int64_t)CostUpperBound);
+ addCost(SwitchCost, static_cast<int64_t>(CostUpperBound));
}
void onMissedSimplification() override {
addCost(InlineConstants::InstrCost);
@@ -938,9 +939,9 @@
}
virtual ~InlineCostCallAnalyzer() {}
- int getThreshold() { return Threshold; }
- int getCost() { return Cost; }
- bool wasDecidedByCostBenefit() { return DecidedByCostBenefit; }
+ int getThreshold() const { return Threshold; }
+ int getCost() const { return Cost; }
+ bool wasDecidedByCostBenefit() const { return DecidedByCostBenefit; }
};
class InlineCostFeaturesAnalyzer final : public CallAnalyzer {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105362.359453.patch
Type: text/x-patch
Size: 1866 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210716/54a5dee0/attachment.bin>
More information about the llvm-commits
mailing list