[InstCombine] Use std::optional in InstructionCombining.cpp (NFC)
authorKazu Hirata <kazu@google.com>
Sat, 26 Nov 2022 07:49:50 +0000 (23:49 -0800)
committerKazu Hirata <kazu@google.com>
Sat, 26 Nov 2022 07:49:50 +0000 (23:49 -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/Transforms/InstCombine/InstructionCombining.cpp

index ee20520..e63c31b 100644 (file)
 
 #define DEBUG_TYPE "instcombine"
 #include "llvm/Transforms/Utils/InstructionWorklist.h"
+#include <optional>
 
 using namespace llvm;
 using namespace llvm::PatternMatch;
@@ -4244,7 +4245,7 @@ bool InstCombinerImpl::run() {
     // prove that the successor is not executed more frequently than our block.
     // Return the UserBlock if successful.
     auto getOptionalSinkBlockForInst =
-        [this](Instruction *I) -> Optional<BasicBlock *> {
+        [this](Instruction *I) -> std::optional<BasicBlock *> {
       if (!EnableCodeSinking)
         return None;