[mlir] Fix two build warnings (NFC)
authorJie Fu <jiefu@tencent.com>
Wed, 15 Mar 2023 04:07:25 +0000 (12:07 +0800)
committerJie Fu <jiefu@tencent.com>
Wed, 15 Mar 2023 04:07:25 +0000 (12:07 +0800)
/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.

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

index f0e3cf3..1c4db01 100644 (file)
@@ -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;
index 5b81295..a584725 100644 (file)
@@ -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));