[Mlir-commits] [mlir] [mlir][Interfaces] Track and infer no-overflow flags in integer ranges (PR #191777)

Mehdi Amini llvmlistbot at llvm.org
Tue Apr 14 10:17:34 PDT 2026


================
@@ -27,6 +27,18 @@
 using namespace mlir;
 using namespace mlir::dataflow;
 
+static ConstantIntRanges makeStaticIndexConstantRange(int32_t indexBitwidth,
+                                                      int64_t value) {
+  ConstantIntRanges range =
+      ConstantIntRanges::constant(APInt(indexBitwidth, value));
+  // For statically-known non-negative metadata constants (e.g. extents), we
+  // can safely carry both no-wrap guarantees.
+  if (range.smin().isNonNegative())
----------------
joker-eph wrote:

Why isn't this just `if (value >= 0)`?

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


More information about the Mlir-commits mailing list