[Mlir-commits] [mlir] 7707ed9 - [mlir] Fix two build warnings (NFC)

Jie Fu llvmlistbot at llvm.org
Tue Mar 14 21:08:05 PDT 2023


Author: Jie Fu
Date: 2023-03-15T12:07:25+08:00
New Revision: 7707ed9727742a78931226def32610fac85b72a2

URL: https://github.com/llvm/llvm-project/commit/7707ed9727742a78931226def32610fac85b72a2
DIFF: https://github.com/llvm/llvm-project/commit/7707ed9727742a78931226def32610fac85b72a2.diff

LOG: [mlir] Fix two build warnings (NFC)

/data/llvm-project/mlir/lib/Dialect/Tensor/Utils/Utils.cpp:62:11: error: comparison of integers of different signs: 'int64_t' (aka 'long') and 'size_t' (aka 'unsigned long') [-Werror,-Wsign-compare]
  if (dim >= shape.size())
      ~~~ ^  ~~~~~~~~~~~~
1 error generated.

/data/llvm-project/mlir/lib/Dialect/Tensor/IR/TensorTilingInterfaceImpl.cpp:484:8: error: unused variable 'appendIndex' [-Werror,-Wunused-variable]
  auto appendIndex = [&](Value val, SmallVector<Value> &dynIndices,
       ^
1 error generated.

Added: 
    

Modified: 
    mlir/lib/Dialect/Tensor/IR/TensorTilingInterfaceImpl.cpp
    mlir/lib/Dialect/Tensor/Utils/Utils.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Dialect/Tensor/IR/TensorTilingInterfaceImpl.cpp b/mlir/lib/Dialect/Tensor/IR/TensorTilingInterfaceImpl.cpp
index f0e3cf36add87..1c4db01dc8f28 100644
--- a/mlir/lib/Dialect/Tensor/IR/TensorTilingInterfaceImpl.cpp
+++ b/mlir/lib/Dialect/Tensor/IR/TensorTilingInterfaceImpl.cpp
@@ -479,18 +479,6 @@ Operation *tensor::bubbleUpPadSlice(OpBuilder &b, tensor::PadOp padOp,
   // Zero index-typed integer.
   OpFoldResult zero = b.getIndexAttr(0);
 
-  // Helper function for filling static/dynamic low/high padding indices
-  // vectors of PadOp.
-  auto appendIndex = [&](Value val, SmallVector<Value> &dynIndices,
-                         SmallVector<int64_t> &staticIndices) {
-    if (auto constInt = getConstantIntValue(val)) {
-      staticIndices.push_back(*constInt);
-    } else {
-      staticIndices.push_back(ShapedType::kDynamic);
-      dynIndices.push_back(val);
-    }
-  };
-
   // Compute new offsets, lengths, low padding, high padding.
   SmallVector<OpFoldResult> newOffsets, newLengths, newStrides;
   SmallVector<OpFoldResult> newLows, newHighs;

diff  --git a/mlir/lib/Dialect/Tensor/Utils/Utils.cpp b/mlir/lib/Dialect/Tensor/Utils/Utils.cpp
index 5b81295e1b91e..a5847250fa915 100644
--- a/mlir/lib/Dialect/Tensor/Utils/Utils.cpp
+++ b/mlir/lib/Dialect/Tensor/Utils/Utils.cpp
@@ -59,7 +59,7 @@ FailureOr<OpFoldResult> mlir::tensor::createDimValue(OpBuilder &b, Location loc,
   if (!tensorTy)
     return failure();
   auto shape = tensorTy.getShape();
-  if (dim >= shape.size())
+  if (dim >= static_cast<int64_t>(shape.size()))
     return failure();
   if (ShapedType::isDynamic(shape[dim]))
     return OpFoldResult(b.createOrFold<tensor::DimOp>(loc, rankedTensor, dim));


        


More information about the Mlir-commits mailing list