[Mlir-commits] [mlir] c308cb9 - [mlir] Fix -Wsign-compare in ResolveShapedTypeResultDims.cpp (NFC)
Jie Fu
llvmlistbot at llvm.org
Tue Oct 31 04:06:44 PDT 2023
Author: Jie Fu
Date: 2023-10-31T19:04:37+08:00
New Revision: c308cb9da65b57da7216a4863ab1a4969de44ccb
URL: https://github.com/llvm/llvm-project/commit/c308cb9da65b57da7216a4863ab1a4969de44ccb
DIFF: https://github.com/llvm/llvm-project/commit/c308cb9da65b57da7216a4863ab1a4969de44ccb.diff
LOG: [mlir] Fix -Wsign-compare in ResolveShapedTypeResultDims.cpp (NFC)
/llvm-project/mlir/lib/Dialect/MemRef/Transforms/ResolveShapedTypeResultDims.cpp:98:19: error: comparison of integers of different signs: 'value_type' (aka 'long long') and 'size_t' (aka 'unsigned long') [-Werror,-Wsign-compare]
if (*dimIndex >= reifiedResultShapes[resultNumber].size())
~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Added:
Modified:
mlir/lib/Dialect/MemRef/Transforms/ResolveShapedTypeResultDims.cpp
Removed:
################################################################################
diff --git a/mlir/lib/Dialect/MemRef/Transforms/ResolveShapedTypeResultDims.cpp b/mlir/lib/Dialect/MemRef/Transforms/ResolveShapedTypeResultDims.cpp
index fe2eede375ec150..0cb5931ce6bf9b9 100644
--- a/mlir/lib/Dialect/MemRef/Transforms/ResolveShapedTypeResultDims.cpp
+++ b/mlir/lib/Dialect/MemRef/Transforms/ResolveShapedTypeResultDims.cpp
@@ -95,7 +95,7 @@ struct DimOfReifyRankedShapedTypeOpInterface : public OpRewritePattern<OpTy> {
return failure();
unsigned resultNumber = dimValue.getResultNumber();
// Do not apply pattern if the IR is invalid (dim out of bounds).
- if (*dimIndex >= reifiedResultShapes[resultNumber].size())
+ if ((size_t)(*dimIndex) >= reifiedResultShapes[resultNumber].size())
return rewriter.notifyMatchFailure(dimOp, "dimension is out of bounds");
Value replacement = getValueOrCreateConstantIndexOp(
rewriter, dimOp.getLoc(), reifiedResultShapes[resultNumber][*dimIndex]);
More information about the Mlir-commits
mailing list