diff options
author | Fangrui Song <i@maskray.me> | 2022-12-14 07:32:24 +0000 |
---|---|---|
committer | Fangrui Song <i@maskray.me> | 2022-12-14 07:32:24 +0000 |
commit | d4b6fcb32e29d0cd834a3c89205fef48fbfc1d2d (patch) | |
tree | a4f06b9386db39ebc28d6cd56a7514fd48661b93 /llvm/lib/Analysis/BranchProbabilityInfo.cpp | |
parent | 4a5d0d8704aa2860c0459a63adfdd415a451c4f1 (diff) | |
download | llvm-d4b6fcb32e29d0cd834a3c89205fef48fbfc1d2d.zip llvm-d4b6fcb32e29d0cd834a3c89205fef48fbfc1d2d.tar.gz llvm-d4b6fcb32e29d0cd834a3c89205fef48fbfc1d2d.tar.bz2 |
[Analysis] llvm::Optional => std::optional
Diffstat (limited to 'llvm/lib/Analysis/BranchProbabilityInfo.cpp')
-rw-r--r-- | llvm/lib/Analysis/BranchProbabilityInfo.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/llvm/lib/Analysis/BranchProbabilityInfo.cpp b/llvm/lib/Analysis/BranchProbabilityInfo.cpp index 1d4159a..b99c361 100644 --- a/llvm/lib/Analysis/BranchProbabilityInfo.cpp +++ b/llvm/lib/Analysis/BranchProbabilityInfo.cpp @@ -647,7 +647,7 @@ computeUnlikelySuccessors(const BasicBlock *BB, Loop *L, } } -Optional<uint32_t> +std::optional<uint32_t> BranchProbabilityInfo::getEstimatedBlockWeight(const BasicBlock *BB) const { auto WeightIt = EstimatedBlockWeight.find(BB); if (WeightIt == EstimatedBlockWeight.end()) @@ -655,7 +655,7 @@ BranchProbabilityInfo::getEstimatedBlockWeight(const BasicBlock *BB) const { return WeightIt->second; } -Optional<uint32_t> +std::optional<uint32_t> BranchProbabilityInfo::getEstimatedLoopWeight(const LoopData &L) const { auto WeightIt = EstimatedLoopWeight.find(L); if (WeightIt == EstimatedLoopWeight.end()) @@ -663,7 +663,7 @@ BranchProbabilityInfo::getEstimatedLoopWeight(const LoopData &L) const { return WeightIt->second; } -Optional<uint32_t> +std::optional<uint32_t> BranchProbabilityInfo::getEstimatedEdgeWeight(const LoopEdge &Edge) const { // For edges entering a loop take weight of a loop rather than an individual // block in the loop. @@ -673,10 +673,10 @@ BranchProbabilityInfo::getEstimatedEdgeWeight(const LoopEdge &Edge) const { } template <class IterT> -Optional<uint32_t> BranchProbabilityInfo::getMaxEstimatedEdgeWeight( +std::optional<uint32_t> BranchProbabilityInfo::getMaxEstimatedEdgeWeight( const LoopBlock &SrcLoopBB, iterator_range<IterT> Successors) const { SmallVector<uint32_t, 4> Weights; - Optional<uint32_t> MaxWeight; + std::optional<uint32_t> MaxWeight; for (const BasicBlock *DstBB : Successors) { const LoopBlock DstLoopBB = getLoopBlock(DstBB); auto Weight = getEstimatedEdgeWeight({SrcLoopBB, DstLoopBB}); @@ -767,8 +767,8 @@ void BranchProbabilityInfo::propagateEstimatedBlockWeight( } } -Optional<uint32_t> BranchProbabilityInfo::getInitialEstimatedBlockWeight( - const BasicBlock *BB) { +std::optional<uint32_t> +BranchProbabilityInfo::getInitialEstimatedBlockWeight(const BasicBlock *BB) { // Returns true if \p BB has call marked with "NoReturn" attribute. auto hasNoReturn = [&](const BasicBlock *BB) { for (const auto &I : reverse(*BB)) @@ -895,7 +895,7 @@ bool BranchProbabilityInfo::calcEstimatedHeuristics(const BasicBlock *BB) { uint64_t TotalWeight = 0; // Go over all successors of BB and put their weights into SuccWeights. for (const BasicBlock *SuccBB : successors(BB)) { - Optional<uint32_t> Weight; + std::optional<uint32_t> Weight; const LoopBlock SuccLoopBB = getLoopBlock(SuccBB); const LoopEdge Edge{LoopBB, SuccLoopBB}; |