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

lonely eagle llvmlistbot at llvm.org
Fri Dec 26 22:49:19 PST 2025


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

>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 1/2] 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());
+  }
 }
 
 //===----------------------------------------------------------------------===//

>From ff1e0e2e214935cd78ec3ed5c00728890748bc74 Mon Sep 17 00:00:00 2001
From: linuxlonelyeagle <2020382038 at qq.com>
Date: Sat, 27 Dec 2025 06:49:04 +0000
Subject: [PATCH 2/2] add beginning of empty block print.

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

diff --git a/mlir/lib/Analysis/DataFlowFramework.cpp b/mlir/lib/Analysis/DataFlowFramework.cpp
index 52b94676b6ead..36b87bd5bb838 100644
--- a/mlir/lib/Analysis/DataFlowFramework.cpp
+++ b/mlir/lib/Analysis/DataFlowFramework.cpp
@@ -70,7 +70,9 @@ void ProgramPoint::print(raw_ostream &os) const {
   if (!isBlockEnd()) {
     os << "<before operation>:"
        << OpWithFlags(getNextOp(), OpPrintingFlags().skipRegions());
+    return;
   }
+  os << "<beginning of empty block>";
 }
 
 //===----------------------------------------------------------------------===//



More information about the Mlir-commits mailing list