[llvm] ea91ae5 - [Analysis] Use std::clamp (NFC)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 22 00:21:14 PDT 2023
Author: Kazu Hirata
Date: 2023-09-22T00:21:06-07:00
New Revision: ea91ae5bc0da56026bc5b4ec52b5e0dd13d408a6
URL: https://github.com/llvm/llvm-project/commit/ea91ae5bc0da56026bc5b4ec52b5e0dd13d408a6
DIFF: https://github.com/llvm/llvm-project/commit/ea91ae5bc0da56026bc5b4ec52b5e0dd13d408a6.diff
LOG: [Analysis] Use std::clamp (NFC)
Added:
Modified:
llvm/lib/Analysis/InlineCost.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/InlineCost.cpp b/llvm/lib/Analysis/InlineCost.cpp
index 7582a43f4f8f825..4fcf5575c74b0a4 100644
--- a/llvm/lib/Analysis/InlineCost.cpp
+++ b/llvm/lib/Analysis/InlineCost.cpp
@@ -612,8 +612,8 @@ class InlineCostCallAnalyzer final : public CallAnalyzer {
/// Handle a capped 'int' increment for Cost.
void addCost(int64_t Inc) {
- Inc = std::max<int64_t>(std::min<int64_t>(INT_MAX, Inc), INT_MIN);
- Cost = std::max<int64_t>(std::min<int64_t>(INT_MAX, Inc + Cost), INT_MIN);
+ Inc = std::clamp<int64_t>(Inc, INT_MIN, INT_MAX);
+ Cost = std::clamp<int64_t>(Inc + Cost, INT_MIN, INT_MAX);
}
void onDisableSROA(AllocaInst *Arg) override {
More information about the llvm-commits
mailing list