[Mlir-commits] [mlir] [mlir][Affine] Genarilze the linearize(delinearize()) simplifications (PR #117637)

Abhishek Varma llvmlistbot at llvm.org
Tue Dec 3 22:41:59 PST 2024


https://github.com/Abhishek-Varma requested changes to this pull request.

It'd be nice to make the current pattern work for the following case :-

```
func.func private @myfunc(%arg0: index) -> (index, index, index) {
  %c0 = arith.constant 0 : index
  %0:3 = affine.delinearize_index %arg0 into (8, 8, 4) : index, index, index
  %1 = affine.linearize_index disjoint [%0#2, %0#0, %c0, %c0] by (4, 8, 4, 8) : index
  %2 = affine.linearize_index disjoint [%0#1, %0#2, %c0, %c0] by (8, 4, 8, 4) : index
  %3 = affine.linearize_index disjoint [%0#1, %0#0, %c0, %c0] by (8, 8, 4, 4) : index
  return %1, %2, %3 : index, index, index
}
```

Basically this is the case where multiple `affine.linearize_index` feed off of SAME `affine.delinearize_index`. Currently this causes ` operand <NUM> does not dominate this use` resulting in an invalid IR.

Perhaps some missing `setInsertionPoint*` in the pattern.

https://github.com/llvm/llvm-project/pull/117637


More information about the Mlir-commits mailing list