summaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/ProfileSummaryInfo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Analysis/ProfileSummaryInfo.cpp')
-rw-r--r--llvm/lib/Analysis/ProfileSummaryInfo.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/llvm/lib/Analysis/ProfileSummaryInfo.cpp b/llvm/lib/Analysis/ProfileSummaryInfo.cpp
index 268ed9d04741..9d5fa6d0a41b 100644
--- a/llvm/lib/Analysis/ProfileSummaryInfo.cpp
+++ b/llvm/lib/Analysis/ProfileSummaryInfo.cpp
@@ -15,7 +15,6 @@
#include "llvm/Analysis/BlockFrequencyInfo.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/Instructions.h"
-#include "llvm/IR/Metadata.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/ProfileSummary.h"
#include "llvm/InitializePasses.h"
@@ -125,7 +124,7 @@ bool ProfileSummaryInfo::isFunctionHotInCallGraph(
for (const auto &I : BB)
if (isa<CallInst>(I) || isa<InvokeInst>(I))
if (auto CallCount = getProfileCount(cast<CallBase>(I), nullptr))
- TotalCallCount += CallCount.getValue();
+ TotalCallCount += *CallCount;
if (isHotCount(TotalCallCount))
return true;
}
@@ -154,7 +153,7 @@ bool ProfileSummaryInfo::isFunctionColdInCallGraph(
for (const auto &I : BB)
if (isa<CallInst>(I) || isa<InvokeInst>(I))
if (auto CallCount = getProfileCount(cast<CallBase>(I), nullptr))
- TotalCallCount += CallCount.getValue();
+ TotalCallCount += *CallCount;
if (!isColdCount(TotalCallCount))
return false;
}
@@ -166,7 +165,7 @@ bool ProfileSummaryInfo::isFunctionColdInCallGraph(
bool ProfileSummaryInfo::isFunctionHotnessUnknown(const Function &F) const {
assert(hasPartialSampleProfile() && "Expect partial sample profile");
- return !F.getEntryCount().hasValue();
+ return !F.getEntryCount();
}
template <bool isHot>
@@ -188,7 +187,7 @@ bool ProfileSummaryInfo::isFunctionHotOrColdInCallGraphNthPercentile(
for (const auto &I : BB)
if (isa<CallInst>(I) || isa<InvokeInst>(I))
if (auto CallCount = getProfileCount(cast<CallBase>(I), nullptr))
- TotalCallCount += CallCount.getValue();
+ TotalCallCount += *CallCount;
if (isHot && isHotCountNthPercentile(PercentileCutoff, TotalCallCount))
return true;
if (!isHot && !isColdCountNthPercentile(PercentileCutoff, TotalCallCount))
@@ -316,11 +315,11 @@ bool ProfileSummaryInfo::isColdCountNthPercentile(int PercentileCutoff,
}
uint64_t ProfileSummaryInfo::getOrCompHotCountThreshold() const {
- return HotCountThreshold.getValueOr(UINT64_MAX);
+ return HotCountThreshold.value_or(UINT64_MAX);
}
uint64_t ProfileSummaryInfo::getOrCompColdCountThreshold() const {
- return ColdCountThreshold.getValueOr(0);
+ return ColdCountThreshold.value_or(0);
}
bool ProfileSummaryInfo::isHotBlock(const BasicBlock *BB,