[Mlir-commits] [mlir] [mlir][bufferization] Relax happens-before analysis (PR #223777)
Matthias Springer
llvmlistbot at llvm.org
Thu Sep 17 17:57:23 PDT 2026
https://github.com/matthias-springer commented:
I found this regression with a coding agent:
```mlir
func.func @nested_diamond_in_outer_cfg_loop(%f: f32) -> tensor<5xf32> {
%empty = tensor.empty() : tensor<5xf32>
%t = linalg.fill ins(%f : f32)
outs(%empty : tensor<5xf32>) -> tensor<5xf32>
%c0 = arith.constant 0 : index
%c1 = arith.constant 1 : index
%c2 = arith.constant 2 : index
cf.br ^loop(%c0 : index)
^loop(%i: index):
%take_read = arith.cmpi eq, %i, %c1 : index
%r = scf.execute_region -> tensor<5xf32> {
cf.cond_br %take_read, ^read, ^write
^read:
%e = tensor.extract %t[%c0] : tensor<5xf32>
"test.qux"(%e) : (f32) -> ()
cf.br ^join(%t : tensor<5xf32>)
^write:
%val = "test.bar"() : () -> f32
%inserted = tensor.insert %val into %t[%c0] : tensor<5xf32>
cf.br ^join(%inserted : tensor<5xf32>)
^join(%out: tensor<5xf32>):
scf.yield %out : tensor<5xf32>
}
%next = arith.addi %i, %c1 : index
%again = arith.cmpi ult, %next, %c2 : index
cf.cond_br %again, ^loop(%next : index),
^exit(%r : tensor<5xf32>)
^exit(%result: tensor<5xf32>):
func.return %result : tensor<5xf32>
}
```
The `tensor.insert_slice` should bufferize out-of-place.
https://github.com/llvm/llvm-project/pull/223777
More information about the Mlir-commits
mailing list