[Mlir-commits] [mlir] ffd84a6 - [mlir] Fix -Wsign-compare in MemRefOps.cpp (NFC)

Jie Fu llvmlistbot at llvm.org
Fri Feb 2 03:32:53 PST 2024


Author: Jie Fu
Date: 2024-02-02T19:32:09+08:00
New Revision: ffd84a6a9afc43968fe24c9057bd4f86e148e283

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

LOG: [mlir] Fix -Wsign-compare in MemRefOps.cpp (NFC)

llvm-project/mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp:2763:23:
error: comparison of integers of different signs: 'int64_t' (aka 'long') and 'size_type' (aka 'unsigned long') [-Werror,-Wsign-compare]
  assert(t1.getRank() == droppedDims.size() && "incorrect number of bits");
         ~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~

llvm-project/mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp:2764:38:
error: comparison of integers of different signs: 'int64_t' (aka 'long') and 'size_type' (aka 'unsigned long') [-Werror,-Wsign-compare]
  assert(t1.getRank() - t2.getRank() == droppedDims.count() &&
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~

Added: 
    

Modified: 
    mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp b/mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp
index 841c5d1686b44..beb7e721ca53b 100644
--- a/mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp
+++ b/mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp
@@ -2760,8 +2760,8 @@ static bool haveCompatibleOffsets(MemRefType t1, MemRefType t2) {
 /// marked as dropped in `droppedDims`.
 static bool haveCompatibleStrides(MemRefType t1, MemRefType t2,
                                   const llvm::SmallBitVector &droppedDims) {
-  assert(t1.getRank() == droppedDims.size() && "incorrect number of bits");
-  assert(t1.getRank() - t2.getRank() == droppedDims.count() &&
+  assert(size_t(t1.getRank()) == droppedDims.size() && "incorrect number of bits");
+  assert(size_t(t1.getRank() - t2.getRank()) == droppedDims.count() &&
          "incorrect number of dropped dims");
   int64_t t1Offset, t2Offset;
   SmallVector<int64_t> t1Strides, t2Strides;


        


More information about the Mlir-commits mailing list