[Mlir-commits] [mlir] [mlir][arith] Fix SelectOp unsafe int range inference with uninitialized range case (PR #173716)

Krzysztof Drewniak llvmlistbot at llvm.org
Thu Jan 8 14:14:06 PST 2026


================
@@ -329,7 +329,13 @@ void arith::SelectOp::inferResultRangesFromOptional(
       setResultRange(getResult(), trueCase);
     return;
   }
-  setResultRange(getResult(), IntegerValueRange::join(trueCase, falseCase));
+
+  // When one of the ranges is uninitialized, set the whole range to max
+  // otherwise the result will ignore the uninitialized range.
+  if (trueCase.isUninitialized() || falseCase.isUninitialized())
----------------
krzysz00 wrote:

... do those operations implement the interface at all? If they don't, then the result should be promoted to max range when the inference for select is called unless it's going down the path that sends in std::optional<ConstantIntRanges>(I might be misspelling the types there - haven't gone and looked) to indicate uninitialized or non-integer arguments.

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


More information about the Mlir-commits mailing list