diff options
author | Kazu Hirata <kazu@google.com> | 2022-06-25 21:42:52 -0700 |
---|---|---|
committer | Kazu Hirata <kazu@google.com> | 2022-06-25 21:42:52 -0700 |
commit | a7938c74f16379704fbd38a3d82dfcb9345651ab (patch) | |
tree | c60b0dce73b749e64ab20d51ef00abfbc547857f /llvm/tools/llvm-profgen/ProfiledBinary.cpp | |
parent | 77295c5486e48a4319efcfc4ac262304c7e7025c (diff) | |
download | llvm-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/tools/llvm-profgen/ProfiledBinary.cpp')
-rw-r--r-- | llvm/tools/llvm-profgen/ProfiledBinary.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/llvm/tools/llvm-profgen/ProfiledBinary.cpp b/llvm/tools/llvm-profgen/ProfiledBinary.cpp index adf7770..3f51455 100644 --- a/llvm/tools/llvm-profgen/ProfiledBinary.cpp +++ b/llvm/tools/llvm-profgen/ProfiledBinary.cpp @@ -100,25 +100,24 @@ BinarySizeContextTracker::getFuncSizeForContext(const SampleContext &Context) { PrevNode = CurrNode; CurrNode = CurrNode->getChildContext(ChildFrame.Location, ChildFrame.FuncName); - if (CurrNode && CurrNode->getFunctionSize().hasValue()) + if (CurrNode && CurrNode->getFunctionSize()) Size = CurrNode->getFunctionSize().getValue(); } // 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()) + if (CurrNode->getFunctionSize()) Size = CurrNode->getFunctionSize().getValue(); } } - assert(Size.hasValue() && "We should at least find one context size."); + assert(Size && "We should at least find one context size."); return Size.getValue(); } |