[Mlir-commits] [mlir] 6fa6901 - Use has_value instead of hasValue (NFC)

Kazu Hirata llvmlistbot at llvm.org
Fri Jul 22 23:04:47 PDT 2022


Author: Kazu Hirata
Date: 2022-07-22T23:04:38-07:00
New Revision: 6fa6901bf0ed27c408e03bbe7b914109e195358b

URL: https://github.com/llvm/llvm-project/commit/6fa6901bf0ed27c408e03bbe7b914109e195358b
DIFF: https://github.com/llvm/llvm-project/commit/6fa6901bf0ed27c408e03bbe7b914109e195358b.diff

LOG: Use has_value instead of hasValue (NFC)

Added: 
    

Modified: 
    llvm/tools/llvm-dwarfutil/DebugInfoLinker.cpp
    mlir/lib/Dialect/Arithmetic/IR/ArithmeticOps.cpp
    mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp
    mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/tools/llvm-dwarfutil/DebugInfoLinker.cpp b/llvm/tools/llvm-dwarfutil/DebugInfoLinker.cpp
index 844ecddc55c55..458a58c12ca72 100644
--- a/llvm/tools/llvm-dwarfutil/DebugInfoLinker.cpp
+++ b/llvm/tools/llvm-dwarfutil/DebugInfoLinker.cpp
@@ -150,9 +150,9 @@ class ObjFileAddressMap : public AddressesMap {
         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<uint64_t> HighPC,

diff  --git a/mlir/lib/Dialect/Arithmetic/IR/ArithmeticOps.cpp b/mlir/lib/Dialect/Arithmetic/IR/ArithmeticOps.cpp
index efec55c125578..d3e7258c568e1 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<Value> basisValues =
       llvm::to_vector(llvm::map_range(basis, [&](OpFoldResult ofr) -> Value {
         Optional<int64_t> staticDim = getConstantIntValue(ofr);
-        if (staticDim.hasValue())
+        if (staticDim.has_value())
           return builder.create<arith::ConstantIndexOp>(result.location,
                                                         *staticDim);
         return ofr.dyn_cast<Value>();

diff  --git a/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp b/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp
index 7590633eedce6..94d789c7f60d7 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<StringAttr>().begin(),
                 getOps()->getAsValueRange<StringAttr>().end());
 
@@ -445,12 +445,12 @@ transform::MatchOp::apply(transform::TransformResults &results,
 
   SmallVector<Operation *> 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<linalg::LinalgOp>(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 1dfaf69efa728..98d5393b6026b 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp
@@ -280,7 +280,7 @@ static FailureOr<ForeachThreadTilingResult> 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),


        


More information about the Mlir-commits mailing list