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

lonely eagle llvmlistbot at llvm.org
Sat Jan 17 23:55:12 PST 2026


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

None

>From 140d3a29464a55ba205c3ad3fe77689b501b6f15 Mon Sep 17 00:00:00 2001
From: linuxlonelyeagle <2020382038 at qq.com>
Date: Sun, 18 Jan 2026 07:44:29 +0000
Subject: [PATCH] improve DataFlowFramework debug output.

---
 mlir/include/mlir/Analysis/DataFlowFramework.h | 2 ++
 mlir/lib/Analysis/DataFlowFramework.cpp        | 5 ++++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/mlir/include/mlir/Analysis/DataFlowFramework.h b/mlir/include/mlir/Analysis/DataFlowFramework.h
index 87ec01a918d90..99801c67280dc 100644
--- a/mlir/include/mlir/Analysis/DataFlowFramework.h
+++ b/mlir/include/mlir/Analysis/DataFlowFramework.h
@@ -707,6 +707,8 @@ class DataFlowAnalysis {
 
   /// Allow the data-flow solver to access the internals of this class.
   friend class DataFlowSolver;
+  // Allow the AnalysisState to access the internals of this class.
+  friend class AnalysisState;
 };
 
 template <typename AnalysisT, typename... Args>
diff --git a/mlir/lib/Analysis/DataFlowFramework.cpp b/mlir/lib/Analysis/DataFlowFramework.cpp
index 56780e8b7b127..2d4ef9f659d5a 100644
--- a/mlir/lib/Analysis/DataFlowFramework.cpp
+++ b/mlir/lib/Analysis/DataFlowFramework.cpp
@@ -46,7 +46,8 @@ void AnalysisState::addDependency(ProgramPoint *dependent,
   DATAFLOW_DEBUG({
     if (inserted) {
       LDBG() << "Creating dependency between " << debugName << " of " << anchor
-             << "\nand " << debugName << " on " << *dependent;
+             << "\nand " << debugName << " on " << *dependent << "\nwith "
+             << analysis->debugName;
     }
   });
 }
@@ -135,6 +136,8 @@ LogicalResult DataFlowSolver::initializeAndRun(Operation *top) {
   // Run the analysis until fixpoint.
   // Iterate until all states are in some initialized state and the worklist
   // is exhausted.
+  DATAFLOW_DEBUG(LDBG() << "Initialize child analyses successfully, start run "
+                           "the analysis until fixpoint");
   while (!worklist.empty()) {
     auto [point, analysis] = worklist.front();
     worklist.pop();



More information about the Mlir-commits mailing list