[Mlir-commits] [mlir] [mlir][dataflow] Improve DataFlowFramework debug output (PR #176632)

lonely eagle llvmlistbot at llvm.org
Thu Feb 5 02:12:48 PST 2026


================
@@ -42,17 +42,32 @@ AnalysisState::~AnalysisState() = default;
 void AnalysisState::addDependency(ProgramPoint *dependent,
                                   DataFlowAnalysis *analysis) {
   auto inserted = dependents.insert({dependent, analysis});
-  (void)inserted;
   DATAFLOW_DEBUG({
     if (inserted) {
       LDBG() << "Creating dependency between " << debugName << " of " << anchor
-             << "\nand " << debugName << " on " << *dependent;
+             << "\nand " << debugName << " on " << *dependent << "\nwith "
+             << analysis->debugName;
     }
   });
 }
 
 void AnalysisState::dump() const { print(llvm::errs()); }
 
+void AnalysisState::onUpdate(DataFlowSolver *solver) const {
+  for (const DataFlowSolver::WorkItem &item : dependents) {
+    DATAFLOW_DEBUG(LDBG() << debugName << " of " << anchor << "\n"
+                          << "Value: " << *this
+                          << "\nenqueueing dependent work item: " << *item.first
+                          << "\nwith " << item.second->debugName);
+    solver->enqueue(item);
+  }
----------------
linuxlonelyeagle wrote:

```
$: mlir-opt a.mlir -int-range-optimizations -debug &> log 

func.func @for_bounds() -> index {
  %c0 = test.with_bounds { umin = 0 : index, umax = 0 : index,
                                smin = 0 : index, smax = 0 : index} : index
  %c1 = test.with_bounds { umin = 1 : index, umax = 1 : index,
                                smin = 1 : index, smax = 1 : index} : index
  %c2 = test.with_bounds { umin = 2 : index, umax = 2 : index,
                                smin = 2 : index, smax = 2 : index} : index

  %0 = scf.for %arg0 = %c0 to %c2 step %c1 iter_args(%arg2 = %c0) -> index {
    scf.yield %arg0 : index
  }
  %1 = test.reflect_bounds %0 : index
  func.return %1 : index
}

```

```
[dataflow DataFlowFramework.cpp:58 1] enqueueing dependent work item: <before operation>:[StaticValueUtils.cpp:343 1] Computing loop trip count for index type may break with overflow
[StaticValueUtils.cpp:343 1] Computing loop trip count for index type may break with overflow
scf.yield %arg0 : index
[dataflow DataFlowFramework.cpp:58 1] with mlir::dataflow::SparseConstantPropagation
[dataflow DataFlowFramework.cpp:58 1] mlir::dataflow::PredecessorState of <before operation>:[StaticValueUtils.cpp:343 1] Computing loop trip count for index type may break with overflow
[StaticValueUtils.cpp:343 1] Computing loop trip count for index type may break with overflow
scf.yield %arg0 : index
[dataflow DataFlowFramework.cpp:58 1] Value: (all) predecessors:
[dataflow DataFlowFramework.cpp:58 1]   [StaticValueUtils.cpp:343 1] Computing loop trip count for index type may break with overflow
[StaticValueUtils.cpp:343 1] Computing loop trip count for index type may break with overflow
%3 = scf.for %arg0 = %0 to %2 step %1 iter_args(%arg1 = %0) -> (index) {...}
[dataflow DataFlowFramework.cpp:58 1]   [StaticValueUtils.cpp:343 1] Computing loop trip count for index type may break with overflow
[StaticValueUtils.cpp:343 1] Computing loop trip count for index type may break with overflow
scf.yield %arg0 : index
[dataflow DataFlowFramework.cpp:58 1] enqueueing dependent work item: <before operation>:[StaticValueUtils.cpp:343 1] Computing loop trip count for index type may break with overflow
[StaticValueUtils.cpp:343 1] Computing loop trip count for index type may break with overflow
scf.yield %arg0 : index
[dataflow DataFlowFramework.cpp:58 1] with mlir::dataflow::IntegerRangeAnalysis
```

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


More information about the Mlir-commits mailing list