IIUC, affine-loop-fusion pass doesn't take into account memory accesses in regions inside of non affine-for ops. In some cases it leads to removing operations that are necessary for another piece of code.
Example (reduced to minimal reproducer from real code):
IIUC, affine-loop-fusion pass doesn't take into account memory accesses in regions inside of non affine-for ops. In some cases it leads to removing operations that are necessary for another piece of code. Example (reduced to minimal reproducer from real code):
command:
mlir-opt -pass-pipeline='builtin.module(func.func(affine-loop-fusion))' example.mlir
Output:So,
alloc_0
becomes uninitialized, but still used by the code after fused loop.Even if I use
affine.if
operation (like on example below) the behavior is the same:hash of last llvm-project's commit: c230138011cbf07ad7caf9d256ae9d0c5032a974