[Mlir-commits] [mlir] [mlir][Transforms] Dialect conversion: Context-aware type conversions (PR #140434)
Jeremy Kun
llvmlistbot at llvm.org
Mon May 19 08:25:32 PDT 2025
j2kun wrote:
I think I have the same concerns as Hongren, mainly that when a region-bearing op is converted today, the block is unlinked and "analyzing the defining op of an SSA value" crashes when the value is a block argument of the old block. To get around this I had to ensure the block arguments were remapped properly, and since we were using attributes attached to the defining op, we had to ensure all our patterns copied over the context attribute (i.e., when converting the region-bearing op in question).
Perhaps you could include a context-aware conversion test that uses a region-bearing op? Maybe something like this which uses the op's attached attribute to define the width of the new type (your "increment" one is fine too)
```mlir
%c0 = arith.constant {width = 64 : index} 0 : index
%0 = affine.for %arg1 = 0 to 3 iter_args(%sum = %c0) {width = 64 : index} -> index {
%1 = arith.addi %sum, %arg1 {width = 64 : index} : index
affine.yield %1 : index
}
```
https://github.com/llvm/llvm-project/pull/140434
More information about the Mlir-commits
mailing list