[llvm] 4a124fd - [Analysis] Use std::optional in InlineCost.cpp (NFC)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 25 10:22:38 PST 2022
Author: Kazu Hirata
Date: 2022-11-25T10:22:33-08:00
New Revision: 4a124fd9d1272a6e06eb96ded9ae815304d462cc
URL: https://github.com/llvm/llvm-project/commit/4a124fd9d1272a6e06eb96ded9ae815304d462cc
DIFF: https://github.com/llvm/llvm-project/commit/4a124fd9d1272a6e06eb96ded9ae815304d462cc.diff
LOG: [Analysis] Use std::optional in InlineCost.cpp (NFC)
This is part of an effort to migrate from llvm::Optional to
std::optional:
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
Added:
Modified:
llvm/lib/Analysis/InlineCost.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/InlineCost.cpp b/llvm/lib/Analysis/InlineCost.cpp
index e17b90844c9a..96b733d82d7f 100644
--- a/llvm/lib/Analysis/InlineCost.cpp
+++ b/llvm/lib/Analysis/InlineCost.cpp
@@ -44,6 +44,7 @@
#include "llvm/Support/raw_ostream.h"
#include <climits>
#include <limits>
+#include <optional>
using namespace llvm;
@@ -489,7 +490,7 @@ class CallAnalyzer : public InstVisitor<CallAnalyzer, bool> {
InlineResult analyze();
- Optional<Constant *> getSimplifiedValue(Instruction *I) {
+ std::optional<Constant *> getSimplifiedValue(Instruction *I) {
if (SimplifiedValues.find(I) != SimplifiedValues.end())
return SimplifiedValues[I];
return None;
@@ -814,7 +815,7 @@ class InlineCostCallAnalyzer final : public CallAnalyzer {
// Determine whether we should inline the given call site, taking into account
// both the size cost and the cycle savings. Return None if we don't have
// suficient profiling information to determine.
- Optional<bool> costBenefitAnalysis() {
+ std::optional<bool> costBenefitAnalysis() {
if (!CostBenefitAnalysisEnabled)
return None;
More information about the llvm-commits
mailing list