[Mlir-commits] [mlir] 2c13075 - [mlir][dataflow] Fix DataFlowFramework crash by add isBlockEnd logic in the ProgramPoint::print (#173471)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Sat Dec 27 01:39:11 PST 2025
Author: lonely eagle
Date: 2025-12-27T17:39:06+08:00
New Revision: 2c13075b2956819dc5a562f14a48d027537cf2e5
URL: https://github.com/llvm/llvm-project/commit/2c13075b2956819dc5a562f14a48d027537cf2e5
DIFF: https://github.com/llvm/llvm-project/commit/2c13075b2956819dc5a562f14a48d027537cf2e5.diff
LOG: [mlir][dataflow] Fix DataFlowFramework crash by add isBlockEnd logic in the ProgramPoint::print (#173471)
Running -test-dead-code-analysis -debug on the following IR will trigger
a data-flow analysis framework assert, you can see
https://github.com/llvm/llvm-project/blob/2d6b1b174194198498eb10ae811632b3dd945ecf/mlir/include/mlir/Analysis/DataFlowFramework.h#L110
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
}
```
Added:
Modified:
mlir/lib/Analysis/DataFlowFramework.cpp
Removed:
################################################################################
diff --git a/mlir/lib/Analysis/DataFlowFramework.cpp b/mlir/lib/Analysis/DataFlowFramework.cpp
index 9352ab02f7472..36b87bd5bb838 100644
--- a/mlir/lib/Analysis/DataFlowFramework.cpp
+++ b/mlir/lib/Analysis/DataFlowFramework.cpp
@@ -67,8 +67,12 @@ 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());
+ return;
+ }
+ os << "<beginning of empty block>";
}
//===----------------------------------------------------------------------===//
More information about the Mlir-commits
mailing list