[llvm] 1493130 - [RISCV] Use std::optional in RISCVMergeBaseOffset.cpp (NFC)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 25 23:08:32 PST 2022


Author: Kazu Hirata
Date: 2022-11-25T23:08:26-08:00
New Revision: 14931309015d62b5cdfe40d1c89433896c7df16c

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

LOG: [RISCV] Use std::optional in RISCVMergeBaseOffset.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/Target/RISCV/RISCVMergeBaseOffset.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/RISCV/RISCVMergeBaseOffset.cpp b/llvm/lib/Target/RISCV/RISCVMergeBaseOffset.cpp
index d18e2ef8723b..a57635abb7e0 100644
--- a/llvm/lib/Target/RISCV/RISCVMergeBaseOffset.cpp
+++ b/llvm/lib/Target/RISCV/RISCVMergeBaseOffset.cpp
@@ -18,6 +18,7 @@
 #include "llvm/MC/TargetRegistry.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Target/TargetOptions.h"
+#include <optional>
 #include <set>
 using namespace llvm;
 
@@ -341,7 +342,7 @@ bool RISCVMergeBaseOffsetOpt::foldIntoMemoryOps(MachineInstr &Hi,
   // Lo:   addi  vreg2, vreg1, %pcrel_lo(1b) ---> lw vreg3, %pcrel_lo(1b)(vreg1)
   // Tail: lw vreg3, 8(vreg2)
 
-  Optional<int64_t> CommonOffset;
+  std::optional<int64_t> CommonOffset;
   for (const MachineInstr &UseMI : MRI->use_instructions(DestReg)) {
     switch (UseMI.getOpcode()) {
     default:


        


More information about the llvm-commits mailing list