Skip to content

Commit

Permalink
[IPO] Use std::optional in IROutliner.cpp (NFC)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
kazutakahirata committed Nov 26, 2022
1 parent a5f8a36 commit c7fa15c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions llvm/lib/Transforms/IPO/IROutliner.cpp
Expand Up @@ -26,6 +26,7 @@
#include "llvm/Pass.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Transforms/IPO.h"
#include <optional>
#include <vector>

#define DEBUG_TYPE "iroutliner"
Expand Down Expand Up @@ -133,7 +134,7 @@ struct OutlinableGroup {

/// The argument that needs to be marked with the swifterr attribute. If not
/// needed, there is no value.
Optional<unsigned> SwiftErrorArgument;
std::optional<unsigned> SwiftErrorArgument;

/// For the \ref Regions, we look at every Value. If it is a constant,
/// we check whether it is the same in Region.
Expand Down Expand Up @@ -2671,7 +2672,7 @@ void IROutliner::updateOutputMapping(OutlinableRegion &Region,
LoadInst *LI) {
// For and load instructions following the call
Value *Operand = LI->getPointerOperand();
Optional<unsigned> OutputIdx;
std::optional<unsigned> OutputIdx;
// Find if the operand it is an output register.
for (unsigned ArgIdx = Region.NumExtractedInputs;
ArgIdx < Region.Call->arg_size(); ArgIdx++) {
Expand Down

0 comments on commit c7fa15c

Please sign in to comment.