[Mlir-commits] [mlir] 0e6c679 - [mlir] Fix warnings

Kazu Hirata llvmlistbot at llvm.org
Thu Nov 2 13:03:01 PDT 2023


Author: Kazu Hirata
Date: 2023-11-02T13:02:55-07:00
New Revision: 0e6c679c1a5c0d3f101335c904583b5d62cb51d3

URL: https://github.com/llvm/llvm-project/commit/0e6c679c1a5c0d3f101335c904583b5d62cb51d3
DIFF: https://github.com/llvm/llvm-project/commit/0e6c679c1a5c0d3f101335c904583b5d62cb51d3.diff

LOG: [mlir] Fix warnings

This patch fixes:

  mlir/lib/Dialect/Tosa/IR/TosaOps.cpp:866:35: error: comparison of
  integers of different signs: 'int64_t' (aka 'long') and 'size_t'
  (aka 'unsigned long') [-Werror,-Wsign-compare]

  mlir/lib/Dialect/Tosa/IR/TosaOps.cpp:888:29: error: comparison of
  integers of different signs: 'int64_t' (aka 'long') and 'size_t'
  (aka 'unsigned long') [-Werror,-Wsign-compare]

  mlir/lib/Dialect/Tosa/IR/TosaOps.cpp:893:59: error: comparison of
  integers of different signs: 'int64_t' (aka 'long') and 'size_t'
  (aka 'unsigned long') [-Werror,-Wsign-compare]

Added: 
    

Modified: 
    mlir/lib/Dialect/Tosa/IR/TosaOps.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp b/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp
index 259799725622269..f490cb1baa30982 100644
--- a/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp
+++ b/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp
@@ -863,7 +863,7 @@ LogicalResult tosa::TileOp::inferReturnTypeComponents(
     outputShape.resize(multiples.size(), ShapedType::kDynamic);
     inferredReturnShapes.push_back(ShapedTypeComponents(outputShape));
     return success();
-  } else if (inputShape.getRank() != multiples.size())
+  } else if (static_cast<size_t>(inputShape.getRank()) != multiples.size())
     return failure();
 
   // Any non dynamic dimension can be multiplied to a known size.
@@ -885,12 +885,13 @@ LogicalResult tosa::TileOp::verify() {
   auto multiples = getMultiples();
 
   if (inputType.hasRank()) {
-    if (inputType.getRank() != multiples.size())
+    if (static_cast<size_t>(inputType.getRank()) != multiples.size())
       return emitOpError("expect 'multiples' array to have length ")
              << inputType.getRank() << " but got " << multiples.size() << ".";
     if (outputType.hasRank() && inputType.getRank() != outputType.getRank())
       return emitOpError("expect same input and output tensor rank.");
-  } else if (outputType.hasRank() && outputType.getRank() != multiples.size())
+  } else if (outputType.hasRank() &&
+             static_cast<size_t>(outputType.getRank()) != multiples.size())
     return emitOpError("expect 'multiples' array to have length ")
            << outputType.getRank() << " but got " << multiples.size() << ".";
 


        


More information about the Mlir-commits mailing list