[Mlir-commits] [mlir] [mlir][dataflow] Fix DataFlowFramework crash by add isBlockEnd logic in the ProgramPoint::print (PR #173471)

lonely eagle llvmlistbot at llvm.org
Wed Dec 24 01:34:01 PST 2025


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

Running -test-dead-code-analysis -debug on the following IR will trigger a data-flow analysis framework assert.Fix DataFlowFramework crash by add isBlockEnd logic in the ProgramPoint::print.
```
func.func @trs(%idx1: index, %idx2: index, %s: f32) {
  scf.parallel (%i) = (%idx1) to (%idx2) step (%idx2) {
    %r = memref.alloca() : memref<10xf32>
    scf.forall (%e2) in (%idx2) {
      %a = memref.load %r[%idx2] : memref<10xf32>
    }
  }
  return
}
```

>From 4a2d2e21cd4aba3f62178a03076148262216ee02 Mon Sep 17 00:00:00 2001
From: linuxlonelyeagle <2020382038 at qq.com>
Date: Wed, 24 Dec 2025 09:19:16 +0000
Subject: [PATCH] fix DataFlowFramework crash by add isBlockEnd logic in the
 ProgramPoint::print.

---
 mlir/lib/Analysis/DataFlowFramework.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/mlir/lib/Analysis/DataFlowFramework.cpp b/mlir/lib/Analysis/DataFlowFramework.cpp
index 9352ab02f7472..52b94676b6ead 100644
--- a/mlir/lib/Analysis/DataFlowFramework.cpp
+++ b/mlir/lib/Analysis/DataFlowFramework.cpp
@@ -67,8 +67,10 @@ void ProgramPoint::print(raw_ostream &os) const {
        << OpWithFlags(getPrevOp(), OpPrintingFlags().skipRegions());
     return;
   }
-  os << "<before operation>:"
-     << OpWithFlags(getNextOp(), OpPrintingFlags().skipRegions());
+  if (!isBlockEnd()) {
+    os << "<before operation>:"
+       << OpWithFlags(getNextOp(), OpPrintingFlags().skipRegions());
+  }
 }
 
 //===----------------------------------------------------------------------===//



More information about the Mlir-commits mailing list