[all-commits] [llvm/llvm-project] 42263f: [mlir][MemRef] Make reinterpret_cast(extract_strid...
qcolombet via All-commits
all-commits at lists.llvm.org
Mon Nov 14 10:03:30 PST 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 42263fb52d627e19a5d00fe57dcd2fe607732ff9
https://github.com/llvm/llvm-project/commit/42263fb52d627e19a5d00fe57dcd2fe607732ff9
Author: Quentin Colombet <quentin.colombet at gmail.com>
Date: 2022-11-14 (Mon, 14 Nov 2022)
Changed paths:
M mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td
M mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp
M mlir/test/Dialect/MemRef/canonicalize.mlir
Log Message:
-----------
[mlir][MemRef] Make reinterpret_cast(extract_strided_metadata) more robust
Prior to this patch the canonicalization pattern that turns
`reinterpret_cast(extract_strided_metadata)` into cast was only applied
when all the input operands of the `reinterpret_cast` are exactly all the
output results of the `extract_strided_metadata`.
This missed simplification opportunities when the values would have hold
the same constant values, but yet, come from different actual values.
E.g., prior to this patch, a pattern of the form:
```
%base, %offset = extract_strided_metadata %source : memref<i16>
reinterpret_cast %base to offset:[0]
```
Wouldn't have been simplified into a simple cast, because %offset is not
directly the same value object as 0.
This patch teaches this pattern how to check if the constant values
match what the results of the `extract_strided_metadata` operation would
have hold.
Differential Revision: https://reviews.llvm.org/D135736
More information about the All-commits
mailing list