aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/llvm-profgen/ProfiledBinary.cpp
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2022-06-25 11:55:57 -0700
committerKazu Hirata <kazu@google.com>2022-06-25 11:55:57 -0700
commitaa8feeefd3ac6c78ee8f67bf033976fc7d68bc6d (patch)
treed207b35cfb445636f41204bcfe51f6ca3a94a3ba /llvm/tools/llvm-profgen/ProfiledBinary.cpp
parentb8df4093e4d82c67a419911a46b63482043643e5 (diff)
downloadllvm-aa8feeefd3ac6c78ee8f67bf033976fc7d68bc6d.zip
llvm-aa8feeefd3ac6c78ee8f67bf033976fc7d68bc6d.tar.gz
llvm-aa8feeefd3ac6c78ee8f67bf033976fc7d68bc6d.tar.bz2
Don't use Optional::hasValue (NFC)
Diffstat (limited to 'llvm/tools/llvm-profgen/ProfiledBinary.cpp')
-rw-r--r--llvm/tools/llvm-profgen/ProfiledBinary.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/llvm/tools/llvm-profgen/ProfiledBinary.cpp b/llvm/tools/llvm-profgen/ProfiledBinary.cpp
index adf7770..aaf7a00 100644
--- a/llvm/tools/llvm-profgen/ProfiledBinary.cpp
+++ b/llvm/tools/llvm-profgen/ProfiledBinary.cpp
@@ -100,26 +100,25 @@ BinarySizeContextTracker::getFuncSizeForContext(const SampleContext &Context) {
PrevNode = CurrNode;
CurrNode =
CurrNode->getChildContext(ChildFrame.Location, ChildFrame.FuncName);
- if (CurrNode && CurrNode->getFunctionSize().hasValue())
- Size = CurrNode->getFunctionSize().getValue();
+ if (CurrNode && CurrNode->getFunctionSize())
+ Size = CurrNode->getFunctionSize().value();
}
// If we traversed all nodes along the path of the context and haven't
// found a size yet, pivot to look for size from sibling nodes, i.e size
// of inlinee under different context.
- if (!Size.hasValue()) {
+ if (!Size) {
if (!CurrNode)
CurrNode = PrevNode;
- while (!Size.hasValue() && CurrNode &&
- !CurrNode->getAllChildContext().empty()) {
+ while (!Size && CurrNode && !CurrNode->getAllChildContext().empty()) {
CurrNode = &CurrNode->getAllChildContext().begin()->second;
- if (CurrNode->getFunctionSize().hasValue())
- Size = CurrNode->getFunctionSize().getValue();
+ if (CurrNode->getFunctionSize())
+ Size = CurrNode->getFunctionSize().value();
}
}
- assert(Size.hasValue() && "We should at least find one context size.");
- return Size.getValue();
+ assert(Size && "We should at least find one context size.");
+ return Size.value();
}
void BinarySizeContextTracker::trackInlineesOptimizedAway(