[Mlir-commits] [mlir] [mlir][dataflow] Drop the firstIndex argument of old visitNonControlFlowArguments, add new visitNonControlFlowArguments API and use it in IntegerRangeAnalysis (PR #175210)

Matthias Springer llvmlistbot at llvm.org
Sun Jan 25 01:12:04 PST 2026


================
@@ -246,5 +199,48 @@ void IntegerRangeAnalysis::visitNonControlFlowArguments(
   }
 
   return SparseForwardDataFlowAnalysis::visitNonControlFlowArguments(
-      op, successor, successorInputs, argLattices, firstIndex);
+      op, successor, successorInputs, argLattices);
+}
+
+void IntegerRangeAnalysis::visitNonControlFlowArguments(
+    Operation *op, Region *const region, ValueRange successorInputs,
+    ArrayRef<IntegerValueRangeLattice *> argLattices) {
+  if (auto inferrable = dyn_cast<InferIntRangeInterface>(op)) {
+    LDBG() << "Inferring ranges for "
+           << OpWithFlags(op, OpPrintingFlags().skipRegions());
+    auto argRanges = llvm::map_to_vector(op->getOperands(), [&](Value value) {
+      return getLatticeElementFor(getProgramPointAfter(op), value)->getValue();
+    });
+
+    auto joinCallback = [&](Value v, const IntegerValueRange &attrs) {
+      auto arg = dyn_cast<BlockArgument>(v);
+      if (!arg)
+        return;
+      if (!llvm::is_contained(region->getArguments(), arg))
+        return;
+
+      LDBG() << "Inferred range " << attrs;
+      IntegerValueRangeLattice *lattice = argLattices[arg.getArgNumber()];
----------------
matthias-springer wrote:

Is this still correct? You are passing a slice of `argLattices` now.

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


More information about the Mlir-commits mailing list