[Mlir-commits] [mlir] deb6fb6 - [mlir][sparse] Fixing -Wsign-compare error in D144773

wren romano llvmlistbot at llvm.org
Mon Mar 6 14:14:36 PST 2023


Author: wren romano
Date: 2023-03-06T14:14:28-08:00
New Revision: deb6fb61844f31f27810679bbe948fe6574998bf

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

LOG: [mlir][sparse] Fixing -Wsign-compare error in D144773

Reviewed By: aartbik, Peiming

Differential Revision: https://reviews.llvm.org/D145420

Added: 
    

Modified: 
    mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp b/mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp
index 9485d9463d26..5220e4df2af4 100644
--- a/mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp
+++ b/mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp
@@ -670,9 +670,11 @@ static LogicalResult verifyPackUnPack(Operation *op, bool requiresStaticShape,
 
   // NOTE: We use `getLvlRank` because the `coordinatesTp` is for
   // level-coordinates (cf., the op documentation).
-  const auto coordsRank = coordinatesTp.getShape()[1];
-  const auto tensorRank = tensorTp.getLvlRank();
-  if (!ShapedType::isDynamic(coordsRank) && (unsigned)coordsRank != tensorRank)
+  const DynSize coordsRank = coordinatesTp.getShape()[1];
+  const Level tensorRank = tensorTp.getLvlRank();
+  // FIXME: replace the `operator!=` with our backported `safelyNE`.
+  if (!ShapedType::isDynamic(coordsRank) &&
+      coordsRank != static_cast<DynSize>(tensorRank))
     return op->emitError("input/output level-ranks don't match");
 
   return success();


        


More information about the Mlir-commits mailing list