[llvm] 3da96e0 - [InstCombine] Use std::optional in InstructionCombining.cpp (NFC)

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


Author: Kazu Hirata
Date: 2022-11-25T23:49:50-08:00
New Revision: 3da96e0361f5b68340891d443c24d62a97af9767

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

LOG: [InstCombine] Use std::optional in InstructionCombining.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/Transforms/InstCombine/InstructionCombining.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
index ee20520e514d..e63c31ba7e05 100644
--- a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
@@ -110,6 +110,7 @@
 
 #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;
 


        


More information about the llvm-commits mailing list