[mlir][MemRef] Simplify extract_strided_metadata(reinterpret_cast)
authorQuentin Colombet <quentin.colombet@gmail.com>
Wed, 12 Oct 2022 21:18:53 +0000 (21:18 +0000)
committerQuentin Colombet <quentin.colombet@gmail.com>
Mon, 14 Nov 2022 18:36:31 +0000 (18:36 +0000)
commit244af24faf3a2a674f38de7b085482e9f49d76fc
tree9f84714d3bdeb6d32e97b06c8615fe70b3af6807
parent4295f8c4c77d32cc742463626cc0919757405376
[mlir][MemRef] Simplify extract_strided_metadata(reinterpret_cast)

This patch adds a pattern to simplify
```
base, offset, sizes, strides =
  extract_strided_metadata(
    reinterpret_cast(src, srcOffset, srcSizes, srcStrides))
```

Into
```
base, baseOffset, ... = extract_strided_metadata(src)
offset = srcOffset
sizes = srcSizes
strides = srcStrides
```

Note: Reinterpret_cast with unranked sources are not simplified since
they cannot feed extract_strided_metadata operations.

Differential Revision: https://reviews.llvm.org/D135837
mlir/lib/Dialect/MemRef/Transforms/SimplifyExtractStridedMetadata.cpp
mlir/test/Dialect/MemRef/simplify-extract-strided-metadata.mlir