From 6fa6901bf0ed27c408e03bbe7b914109e195358b Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Fri, 22 Jul 2022 23:04:38 -0700 Subject: [PATCH] Use has_value instead of hasValue (NFC) --- llvm/tools/llvm-dwarfutil/DebugInfoLinker.cpp | 4 ++-- mlir/lib/Dialect/Arithmetic/IR/ArithmeticOps.cpp | 2 +- mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp | 8 ++++---- mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/llvm/tools/llvm-dwarfutil/DebugInfoLinker.cpp b/llvm/tools/llvm-dwarfutil/DebugInfoLinker.cpp index 844ecdd..458a58c 100644 --- a/llvm/tools/llvm-dwarfutil/DebugInfoLinker.cpp +++ b/llvm/tools/llvm-dwarfutil/DebugInfoLinker.cpp @@ -150,9 +150,9 @@ protected: TextAddressRanges.getRangeThatContains(LowPC); if (HighPC) - return Range.hasValue() && Range->end() >= *HighPC; + return Range.has_value() && Range->end() >= *HighPC; - return Range.hasValue(); + return Range.has_value(); } uint64_t isBFDDeadAddressRange(uint64_t LowPC, Optional HighPC, diff --git a/mlir/lib/Dialect/Arithmetic/IR/ArithmeticOps.cpp b/mlir/lib/Dialect/Arithmetic/IR/ArithmeticOps.cpp index efec55c..d3e7258 100644 --- a/mlir/lib/Dialect/Arithmetic/IR/ArithmeticOps.cpp +++ b/mlir/lib/Dialect/Arithmetic/IR/ArithmeticOps.cpp @@ -2054,7 +2054,7 @@ void arith::DelinearizeIndexOp::build(OpBuilder &builder, SmallVector basisValues = llvm::to_vector(llvm::map_range(basis, [&](OpFoldResult ofr) -> Value { Optional staticDim = getConstantIntValue(ofr); - if (staticDim.hasValue()) + if (staticDim.has_value()) return builder.create(result.location, *staticDim); return ofr.dyn_cast(); diff --git a/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp b/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp index 7590633..94d789c 100644 --- a/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp +++ b/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp @@ -434,7 +434,7 @@ DiagnosedSilenceableFailure transform::MatchOp::apply(transform::TransformResults &results, transform::TransformState &state) { llvm::StringSet<> strs; - if (getOps().hasValue()) + if (getOps().has_value()) strs.insert(getOps()->getAsValueRange().begin(), getOps()->getAsValueRange().end()); @@ -445,12 +445,12 @@ transform::MatchOp::apply(transform::TransformResults &results, SmallVector res; auto matchFun = [&](Operation *op) { - if (getOps().hasValue() && !strs.contains(op->getName().getStringRef())) + if (getOps().has_value() && !strs.contains(op->getName().getStringRef())) return WalkResult::advance(); // Interfaces cannot be matched by name, just by ID. // So we specifically encode the interfaces we care about for this op. - if (getInterface().hasValue()) { + if (getInterface().has_value()) { auto iface = getInterface().getValue(); if (iface == transform::MatchInterfaceEnum::LinalgOp && !isa(op)) @@ -460,7 +460,7 @@ transform::MatchOp::apply(transform::TransformResults &results, return WalkResult::advance(); } - if (getAttribute().hasValue() && !op->hasAttr(getAttribute().getValue())) + if (getAttribute().has_value() && !op->hasAttr(getAttribute().getValue())) return WalkResult::advance(); // All constraints are satisfied. diff --git a/mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp b/mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp index 1dfaf69..98d5393 100644 --- a/mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp +++ b/mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp @@ -280,7 +280,7 @@ static FailureOr tileToForeachThreadOpImpl( // Symbolic fixed max size per thread. // TODO: floor + 0/1 depending on case for better load-balancing. OpFoldResult tileSizePerThread = - nominalTileSizes.hasValue() + nominalTileSizes.has_value() ? (*nominalTileSizes)[loopIdx] : makeComposedFoldedAffineApply( b, loc, M.ceilDiv(N), -- 2.7.4