[llvm] 400db9c - [MC] Use std::optional in MCSchedule.cpp (NFC)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 25 12:28:47 PST 2022


Author: Kazu Hirata
Date: 2022-11-25T12:28:42-08:00
New Revision: 400db9c8a5cfa1496c5af85d2bc2ee26c80a7bcb

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

LOG: [MC] Use std::optional in MCSchedule.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/MC/MCSchedule.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/MC/MCSchedule.cpp b/llvm/lib/MC/MCSchedule.cpp
index 71c8e6f02f8e..2641d525cf05 100644
--- a/llvm/lib/MC/MCSchedule.cpp
+++ b/llvm/lib/MC/MCSchedule.cpp
@@ -15,6 +15,7 @@
 #include "llvm/MC/MCInstrDesc.h"
 #include "llvm/MC/MCInstrInfo.h"
 #include "llvm/MC/MCSubtargetInfo.h"
+#include <optional>
 #include <type_traits>
 
 using namespace llvm;
@@ -87,7 +88,7 @@ int MCSchedModel::computeInstrLatency(const MCSubtargetInfo &STI,
 double
 MCSchedModel::getReciprocalThroughput(const MCSubtargetInfo &STI,
                                       const MCSchedClassDesc &SCDesc) {
-  Optional<double> Throughput;
+  std::optional<double> Throughput;
   const MCSchedModel &SM = STI.getSchedModel();
   const MCWriteProcResEntry *I = STI.getWriteProcResBegin(&SCDesc);
   const MCWriteProcResEntry *E = STI.getWriteProcResEnd(&SCDesc);
@@ -133,7 +134,7 @@ MCSchedModel::getReciprocalThroughput(const MCSubtargetInfo &STI,
 double
 MCSchedModel::getReciprocalThroughput(unsigned SchedClass,
                                       const InstrItineraryData &IID) {
-  Optional<double> Throughput;
+  std::optional<double> Throughput;
   const InstrStage *I = IID.beginStage(SchedClass);
   const InstrStage *E = IID.endStage(SchedClass);
   for (; I != E; ++I) {


        


More information about the llvm-commits mailing list