aboutsummaryrefslogtreecommitdiff
path: root/mlir/lib/Rewrite/ByteCode.cpp
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2023-01-14 01:25:58 -0800
committerKazu Hirata <kazu@google.com>2023-01-14 01:25:58 -0800
commit0a81ace0047a2de93e71c82cdf0977fc989660df (patch)
tree79f7603ad4f5fa96332507dcea07fb3be4a966a5 /mlir/lib/Rewrite/ByteCode.cpp
parentbb83dc10f5e7aece86a0ad2158cfd28d1611f336 (diff)
downloadllvm-0a81ace0047a2de93e71c82cdf0977fc989660df.zip
llvm-0a81ace0047a2de93e71c82cdf0977fc989660df.tar.gz
llvm-0a81ace0047a2de93e71c82cdf0977fc989660df.tar.bz2
[mlir] Use std::optional instead of llvm::Optional (NFC)
This patch replaces (llvm::|)Optional< with std::optional<. I'll post a separate patch to remove #include "llvm/ADT/Optional.h". 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
Diffstat (limited to 'mlir/lib/Rewrite/ByteCode.cpp')
-rw-r--r--mlir/lib/Rewrite/ByteCode.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/mlir/lib/Rewrite/ByteCode.cpp b/mlir/lib/Rewrite/ByteCode.cpp
index 6b11220..1ea4bef 100644
--- a/mlir/lib/Rewrite/ByteCode.cpp
+++ b/mlir/lib/Rewrite/ByteCode.cpp
@@ -487,13 +487,13 @@ struct ByteCodeLiveRange {
std::unique_ptr<llvm::IntervalMap<uint64_t, char, 16>> liveness;
/// The operation range storage index for this range.
- Optional<unsigned> opRangeIndex;
+ std::optional<unsigned> opRangeIndex;
/// The type range storage index for this range.
- Optional<unsigned> typeRangeIndex;
+ std::optional<unsigned> typeRangeIndex;
/// The value range storage index for this range.
- Optional<unsigned> valueRangeIndex;
+ std::optional<unsigned> valueRangeIndex;
};
} // namespace
@@ -1107,7 +1107,7 @@ public:
LogicalResult
execute(PatternRewriter &rewriter,
SmallVectorImpl<PDLByteCode::MatchResult> *matches = nullptr,
- Optional<Location> mainRewriteLoc = {});
+ std::optional<Location> mainRewriteLoc = {});
private:
/// Internal implementation of executing each of the bytecode commands.
@@ -1450,11 +1450,11 @@ LogicalResult ByteCodeExecutor::executeApplyRewrite(PatternRewriter &rewriter) {
// If the result is a range, we need to copy it over to the bytecodes
// range memory.
- if (Optional<TypeRange> typeRange = result.dyn_cast<TypeRange>()) {
+ if (std::optional<TypeRange> typeRange = result.dyn_cast<TypeRange>()) {
unsigned rangeIndex = read();
typeRangeMemory[rangeIndex] = *typeRange;
memory[read()] = &typeRangeMemory[rangeIndex];
- } else if (Optional<ValueRange> valueRange =
+ } else if (std::optional<ValueRange> valueRange =
result.dyn_cast<ValueRange>()) {
unsigned rangeIndex = read();
valueRangeMemory[rangeIndex] = *valueRange;
@@ -2110,7 +2110,7 @@ void ByteCodeExecutor::executeSwitchTypes() {
LogicalResult
ByteCodeExecutor::execute(PatternRewriter &rewriter,
SmallVectorImpl<PDLByteCode::MatchResult> *matches,
- Optional<Location> mainRewriteLoc) {
+ std::optional<Location> mainRewriteLoc) {
while (true) {
// Print the location of the operation being executed.
LLVM_DEBUG(llvm::dbgs() << readInline<Location>() << "\n");