[llvm] c6007e5 - [Support] Use std::optional in InstructionCost.h (NFC)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 27 14:16:28 PST 2022


Author: Kazu Hirata
Date: 2022-11-27T14:16:09-08:00
New Revision: c6007e59f099a40efeeb0e91039ba6c02846ed7b

URL: https://github.com/llvm/llvm-project/commit/c6007e59f099a40efeeb0e91039ba6c02846ed7b
DIFF: https://github.com/llvm/llvm-project/commit/c6007e59f099a40efeeb0e91039ba6c02846ed7b.diff

LOG: [Support] Use std::optional in InstructionCost.h (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/include/llvm/Support/InstructionCost.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Support/InstructionCost.h b/llvm/include/llvm/Support/InstructionCost.h
index aa8825ea9eaa..84272355912d 100644
--- a/llvm/include/llvm/Support/InstructionCost.h
+++ b/llvm/include/llvm/Support/InstructionCost.h
@@ -21,6 +21,7 @@
 #include "llvm/ADT/Optional.h"
 #include "llvm/Support/MathExtras.h"
 #include <limits>
+#include <optional>
 
 namespace llvm {
 
@@ -84,7 +85,7 @@ class InstructionCost {
   /// This function is intended to be used as sparingly as possible, since the
   /// class provides the full range of operator support required for arithmetic
   /// and comparisons.
-  Optional<CostType> getValue() const {
+  std::optional<CostType> getValue() const {
     if (isValid())
       return Value;
     return None;


        


More information about the llvm-commits mailing list