[Analysis] Use std::optional in InlineCost.cpp (NFC)
authorKazu Hirata <kazu@google.com>
Fri, 25 Nov 2022 18:22:33 +0000 (10:22 -0800)
committerKazu Hirata <kazu@google.com>
Fri, 25 Nov 2022 18:22:33 +0000 (10:22 -0800)
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

llvm/lib/Analysis/InlineCost.cpp

index e17b908..96b733d 100644 (file)
@@ -44,6 +44,7 @@
 #include "llvm/Support/raw_ostream.h"
 #include <climits>
 #include <limits>
+#include <optional>
 
 using namespace llvm;
 
@@ -489,7 +490,7 @@ public:
 
   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;