[PATCH] D139796: [BOLT][NFC] Use std::optional in BAT
Amir Ayupov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Dec 11 11:54:32 PST 2022
Amir created this revision.
Amir added a reviewer: bolt.
Herald added a reviewer: rafauler.
Herald added subscribers: treapster, ayermolo.
Herald added a reviewer: maksfb.
Herald added a project: All.
Amir requested review of this revision.
Herald added subscribers: llvm-commits, yota9.
Herald added a project: LLVM.
Part of an ongoing migration from llvm::Optional to std::optional:
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D139796
Files:
bolt/include/bolt/Profile/BoltAddressTranslation.h
bolt/include/bolt/Profile/DataAggregator.h
bolt/lib/Profile/BoltAddressTranslation.cpp
bolt/lib/Profile/DataAggregator.cpp
Index: bolt/lib/Profile/DataAggregator.cpp
===================================================================
--- bolt/lib/Profile/DataAggregator.cpp
+++ bolt/lib/Profile/DataAggregator.cpp
@@ -831,7 +831,7 @@
return false;
}
- Optional<BoltAddressTranslation::FallthroughListTy> FTs =
+ std::optional<BoltAddressTranslation::FallthroughListTy> FTs =
BAT ? BAT->getFallthroughsInTrace(FromFunc->getAddress(), First.To,
Second.From)
: getFallthroughsInTrace(*FromFunc, First, Second, Count);
@@ -943,7 +943,7 @@
return true;
}
-Optional<SmallVector<std::pair<uint64_t, uint64_t>, 16>>
+std::optional<SmallVector<std::pair<uint64_t, uint64_t>, 16>>
DataAggregator::getFallthroughsInTrace(BinaryFunction &BF,
const LBREntry &FirstLBR,
const LBREntry &SecondLBR,
Index: bolt/lib/Profile/BoltAddressTranslation.cpp
===================================================================
--- bolt/lib/Profile/BoltAddressTranslation.cpp
+++ bolt/lib/Profile/BoltAddressTranslation.cpp
@@ -248,7 +248,7 @@
return Offset - KeyVal->first + Val;
}
-Optional<BoltAddressTranslation::FallthroughListTy>
+std::optional<BoltAddressTranslation::FallthroughListTy>
BoltAddressTranslation::getFallthroughsInTrace(uint64_t FuncAddress,
uint64_t From,
uint64_t To) const {
Index: bolt/include/bolt/Profile/DataAggregator.h
===================================================================
--- bolt/include/bolt/Profile/DataAggregator.h
+++ bolt/include/bolt/Profile/DataAggregator.h
@@ -206,7 +206,7 @@
/// Return a vector of offsets corresponding to a trace in a function
/// (see recordTrace() above).
- Optional<SmallVector<std::pair<uint64_t, uint64_t>, 16>>
+ std::optional<SmallVector<std::pair<uint64_t, uint64_t>, 16>>
getFallthroughsInTrace(BinaryFunction &BF, const LBREntry &First,
const LBREntry &Second, uint64_t Count = 1) const;
Index: bolt/include/bolt/Profile/BoltAddressTranslation.h
===================================================================
--- bolt/include/bolt/Profile/BoltAddressTranslation.h
+++ bolt/include/bolt/Profile/BoltAddressTranslation.h
@@ -9,11 +9,11 @@
#ifndef BOLT_PROFILE_BOLTADDRESSTRANSLATION_H
#define BOLT_PROFILE_BOLTADDRESSTRANSLATION_H
-#include "llvm/ADT/Optional.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include <cstdint>
#include <map>
+#include <optional>
#include <system_error>
namespace llvm {
@@ -98,9 +98,9 @@
/// taken in the path started at FirstLBR.To and ending at SecondLBR.From.
/// Return std::nullopt if trace is invalid or the list of fall-throughs
/// otherwise.
- Optional<FallthroughListTy> getFallthroughsInTrace(uint64_t FuncAddress,
- uint64_t From,
- uint64_t To) const;
+ std::optional<FallthroughListTy> getFallthroughsInTrace(uint64_t FuncAddress,
+ uint64_t From,
+ uint64_t To) const;
/// If available, fetch the address of the hot part linked to the cold part
/// at \p Address. Return 0 otherwise.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D139796.481941.patch
Type: text/x-patch
Size: 3443 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221211/68a0534d/attachment.bin>
More information about the llvm-commits
mailing list