Author: lonely eagle
Date: 2026-01-20T20:09:40+08:00
New Revision: e4f6b039e9af30df117439c67513d49ff7960c30

URL: 
https://github.com/llvm/llvm-project/commit/e4f6b039e9af30df117439c67513d49ff7960c30
DIFF: 
https://github.com/llvm/llvm-project/commit/e4f6b039e9af30df117439c67513d49ff7960c30.diff

LOG: Revert "[mlir][dataflow] Drop DATAFLOW_DEBUG (NFC) (#176731)"

This reverts commit b36d004743dd47cfa32bba524e8f14b4a290acb9.

Added: 
    

Modified: 
    mlir/lib/Analysis/DataFlowFramework.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Analysis/DataFlowFramework.cpp 
b/mlir/lib/Analysis/DataFlowFramework.cpp
index c848a98576845..56780e8b7b127 100644
--- a/mlir/lib/Analysis/DataFlowFramework.cpp
+++ b/mlir/lib/Analysis/DataFlowFramework.cpp
@@ -19,6 +19,11 @@
 #include "llvm/Support/raw_ostream.h"
 
 #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
 
 using namespace mlir;
 
@@ -38,10 +43,12 @@ void AnalysisState::addDependency(ProgramPoint *dependent,
                                   DataFlowAnalysis *analysis) {
   auto inserted = dependents.insert({dependent, analysis});
   (void)inserted;
-  if (inserted) {
-    LDBG() << "Creating dependency between " << debugName << " of " << anchor
-           << "\nand " << debugName << " on " << *dependent;
-  }
+  DATAFLOW_DEBUG({
+    if (inserted) {
+      LDBG() << "Creating dependency between " << debugName << " of " << anchor
+             << "\nand " << debugName << " on " << *dependent;
+    }
+  });
 }
 
 void AnalysisState::dump() const { print(llvm::errs()); }
@@ -120,7 +127,7 @@ LogicalResult DataFlowSolver::initializeAndRun(Operation 
*top) {
 
   // Initialize the analyses.
   for (DataFlowAnalysis &analysis : llvm::make_pointee_range(childAnalyses)) {
-    LDBG() << "Priming analysis: " << analysis.debugName;
+    DATAFLOW_DEBUG(LDBG() << "Priming analysis: " << analysis.debugName);
     if (failed(analysis.initialize(top)))
       return failure();
   }
@@ -132,7 +139,8 @@ LogicalResult DataFlowSolver::initializeAndRun(Operation 
*top) {
     auto [point, analysis] = worklist.front();
     worklist.pop();
 
-    LDBG() << "Invoking '" << analysis->debugName << "' on: " << *point;
+    DATAFLOW_DEBUG(LDBG() << "Invoking '" << analysis->debugName
+                          << "' on: " << *point);
     if (failed(analysis->visit(point)))
       return failure();
   }
@@ -145,9 +153,9 @@ void DataFlowSolver::propagateIfChanged(AnalysisState 
*state,
   assert(isRunning &&
          "DataFlowSolver is not running, should not use propagateIfChanged");
   if (changed == ChangeResult::Change) {
-    LDBG() << "Propagating update to " << state->debugName << " of "
-           << state->anchor << "\n"
-           << "Value: " << *state;
+    DATAFLOW_DEBUG(LDBG() << "Propagating update to " << state->debugName
+                          << " of " << state->anchor << "\n"
+                          << "Value: " << *state);
     state->onUpdate(this);
   }
 }


        
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to