[Mlir-commits] [mlir] [mlir] fix IntegerRangeAnalysis::staticallyNonNegative (PR #134003)

Krzysztof Drewniak llvmlistbot at llvm.org
Wed Apr 2 16:59:34 PDT 2025


krzysz00 wrote:

Ah - I had my terminology backwards, then.

I figured that having the non-integer values be `std::nullopt` would be fine, since the inference method would just get `nullopt` for its non-integer arguments - that is, for values that aren't integers, the existing code assumed that `uninitialized` was the only possible inhabitant of the lattice for those types.

Using `ConstantIntRanges` with 0-bit APInts would be fine as a "we know there can't be data here" value ... but, in order to uphold the interface contract of `InferIntRanges`, we'll need a followup patch that maps that 0-width stat back to `std::nullopt` ... and probably need to update anything that consumes integer range lattice values directly to know about this new behavior.

I'm not opposed to adding a distinct end state for non-integer values, but that'll require auditing the code to make sure that that state's being checked correctly.

https://github.com/llvm/llvm-project/pull/134003


More information about the Mlir-commits mailing list