[llvm] 881076c - [InstCombine] Use std::optional in InstCombinePHI.cpp (NFC)

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


Author: Kazu Hirata
Date: 2022-11-25T23:46:38-08:00
New Revision: 881076cde29699ef2a458c9d957ebcd49ded8893

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

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp b/llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp
index e9773480fd974..7ab440655c587 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp
@@ -20,6 +20,7 @@
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Transforms/InstCombine/InstCombiner.h"
 #include "llvm/Transforms/Utils/Local.h"
+#include <optional>
 
 using namespace llvm;
 using namespace llvm::PatternMatch;
@@ -1328,7 +1329,7 @@ static Value *simplifyUsingControlFlow(InstCombiner &Self, PHINode &PN,
 
   // Check that edges outgoing from the idom's terminators dominate respective
   // inputs of the Phi.
-  Optional<bool> Invert;
+  std::optional<bool> Invert;
   for (auto Pair : zip(PN.incoming_values(), PN.blocks())) {
     auto *Input = cast<ConstantInt>(std::get<0>(Pair));
     BasicBlock *Pred = std::get<1>(Pair);


        


More information about the llvm-commits mailing list