[Mlir-commits] [mlir] dc39028 - [mlir] Fix -Wsign-compare in ValueBoundsOpInterface.cpp (NFC)

Jie Fu llvmlistbot at llvm.org
Wed Apr 10 23:51:31 PDT 2024


Author: Jie Fu
Date: 2024-04-11T14:50:40+08:00
New Revision: dc39028906ba4196c3ba544c43ef6b428cf47c51

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

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

/llvm-project/mlir/lib/Interfaces/ValueBoundsOpInterface.cpp:762:16:
error: comparison of integers of different signs: 'int64_t' (aka 'long') and 'size_t' (aka 'unsigned long') [-Werror,-Wsign-compare]
        rhsPos >= cstr.positionToValueDim.size())
        ~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/llvm-project/mlir/lib/Interfaces/ValueBoundsOpInterface.cpp:761:16:
error: comparison of integers of different signs: 'int64_t' (aka 'long') and 'size_t' (aka 'unsigned long') [-Werror,-Wsign-compare]
    if (lhsPos >= cstr.positionToValueDim.size() ||
        ~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 errors generated.

Added: 
    

Modified: 
    mlir/lib/Interfaces/ValueBoundsOpInterface.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Interfaces/ValueBoundsOpInterface.cpp b/mlir/lib/Interfaces/ValueBoundsOpInterface.cpp
index fa66da4a0def93..ffa4c0b55cad7c 100644
--- a/mlir/lib/Interfaces/ValueBoundsOpInterface.cpp
+++ b/mlir/lib/Interfaces/ValueBoundsOpInterface.cpp
@@ -758,8 +758,8 @@ bool ValueBoundsConstraintSet::compare(AffineMap lhs, ValueDimList lhsOperands,
   auto stopCondition = [&](Value v, std::optional<int64_t> dim,
                            ValueBoundsConstraintSet &cstr) {
     // Keep processing as long as lhs/rhs were not processed.
-    if (lhsPos >= cstr.positionToValueDim.size() ||
-        rhsPos >= cstr.positionToValueDim.size())
+    if (size_t(lhsPos) >= cstr.positionToValueDim.size() ||
+        size_t(rhsPos) >= cstr.positionToValueDim.size())
       return false;
     // Keep processing as long as the relation cannot be proven.
     return cstr.comparePos(lhsPos, cmp, rhsPos);


        


More information about the Mlir-commits mailing list