aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/InlineCost.cpp
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2022-06-25 21:42:52 -0700
committerKazu Hirata <kazu@google.com>2022-06-25 21:42:52 -0700
commita7938c74f16379704fbd38a3d82dfcb9345651ab (patch)
treec60b0dce73b749e64ab20d51ef00abfbc547857f /llvm/lib/Analysis/InlineCost.cpp
parent77295c5486e48a4319efcfc4ac262304c7e7025c (diff)
downloadllvm-a7938c74f16379704fbd38a3d82dfcb9345651ab.zip
llvm-a7938c74f16379704fbd38a3d82dfcb9345651ab.tar.gz
llvm-a7938c74f16379704fbd38a3d82dfcb9345651ab.tar.bz2
[llvm] Don't use Optional::hasValue (NFC)
This patch replaces Optional::hasValue with the implicit cast to bool in conditionals only.
Diffstat (limited to 'llvm/lib/Analysis/InlineCost.cpp')
-rw-r--r--llvm/lib/Analysis/InlineCost.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/Analysis/InlineCost.cpp b/llvm/lib/Analysis/InlineCost.cpp
index 63fe651..753071c 100644
--- a/llvm/lib/Analysis/InlineCost.cpp
+++ b/llvm/lib/Analysis/InlineCost.cpp
@@ -703,7 +703,7 @@ class InlineCostCallAnalyzer final : public CallAnalyzer {
BlockFrequencyInfo *BFI = &(GetBFI(F));
assert(BFI && "BFI must be available");
auto ProfileCount = BFI->getBlockProfileCount(BB);
- assert(ProfileCount.hasValue());
+ assert(ProfileCount);
if (ProfileCount.getValue() == 0)
ColdSize += Cost - CostAtBBStart;
}
@@ -828,14 +828,14 @@ class InlineCostCallAnalyzer final : public CallAnalyzer {
}
auto ProfileCount = CalleeBFI->getBlockProfileCount(&BB);
- assert(ProfileCount.hasValue());
+ assert(ProfileCount);
CurrentSavings *= ProfileCount.getValue();
CycleSavings += CurrentSavings;
}
// Compute the cycle savings per call.
auto EntryProfileCount = F.getEntryCount();
- assert(EntryProfileCount.hasValue() && EntryProfileCount->getCount());
+ assert(EntryProfileCount && EntryProfileCount->getCount());
auto EntryCount = EntryProfileCount->getCount();
CycleSavings += EntryCount / 2;
CycleSavings = CycleSavings.udiv(EntryCount);