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

lonely eagle llvmlistbot at llvm.org
Thu Jan 22 08:29:07 PST 2026


================
@@ -46,13 +46,27 @@ 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;
     }
   });
 }
 
 void AnalysisState::dump() const { print(llvm::errs()); }
 
+void AnalysisState::onUpdate(DataFlowSolver *solver) const {
+  for (const DataFlowSolver::WorkItem &item : dependents) {
+    DATAFLOW_DEBUG(LDBG() << "Enqueueing dependent work item: " << *item.first
----------------
linuxlonelyeagle wrote:

You can see
```
#define DEBUG_TYPE "dataflow"
#if LLVM_ENABLE_ABI_BREAKING_CHECKS
#define DATAFLOW_DEBUG(X) LLVM_DEBUG(X)
#else
#define DATAFLOW_DEBUG(X)
#endif // LLVM_ENABLE_ABI_BREAKING_CHECKS
```
and https://github.com/llvm/llvm-project/blob/a92cf1910647ce35027242d9de51ed1e7ca5eb84/mlir/include/mlir/Analysis/DataFlowFramework.h#L518

If LLVM_ENABLE_ABI_BREAKING_CHECKS is not defined, the code inside DATAFLOW_DEBUG(X) is stripped away. However, if we use LDBG() instead, it still attempts to print debugName, which ends up being undefined when ABI-breaking checks are disabled.


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


More information about the Mlir-commits mailing list