[Mlir-commits] [mlir] [mlir][dataflow] Drop the firstIndex argument of old visitNonControlFlowArguments, add new visitNonControlFlowArguments API and use it in IntegerRangeAnalysis (PR #175210)
lonely eagle
llvmlistbot at llvm.org
Sun Jan 25 10:19:44 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()];
----------------
linuxlonelyeagle wrote:
It is correct. You can see https://github.com/llvm/llvm-project/blob/73789e07e3dead9c90bf746ea67c84a0ba78da39/mlir/lib/Analysis/DataFlow/SparseAnalysis.cpp#L189.it is not a slice of argLattices.
https://github.com/llvm/llvm-project/pull/175210
More information about the Mlir-commits
mailing list