[Mlir-commits] [mlir] [mlir][integer-range-analysis] expose helpers in header and fix ConstantIntRange print (PR #127888)
Krzysztof Drewniak
llvmlistbot at llvm.org
Wed Feb 19 11:58:24 PST 2025
================
@@ -71,6 +71,19 @@ class IntegerRangeAnalysis
unsigned firstIndex) override;
};
+/// Succeeds if an op can be converted to its unsigned equivalent without
+/// changing its semantics. This is the case when none of its openands or
+/// results can be below 0 when analyzed from a signed perspective.
+LogicalResult staticallyNonNegative(DataFlowSolver &solver, Operation *op);
+
+/// Succeeds when a value is statically non-negative in that it has a lower
+/// bound on its value (if it is treated as signed) and that bound is
+/// non-negative.
+// TODO: IntegerRangeAnalysis internally assumes index is 64bit and this pattern
+// relies on this. These transformations may not be valid for 32bit index,
----------------
krzysz00 wrote:
The comment here refers to "these transformations" , which are the ones in `UnsignedWhenEquivalent`. You might want to put the transformations comment back in that file, and here add a warning that the results of this query may not be accurate for `index` if you plan to use a non-64-bit `index`.
https://github.com/llvm/llvm-project/pull/127888
More information about the Mlir-commits
mailing list