[MLIR][MemRef] Only allow fold of cast for the pointer operand, not the value
authorWilliam S. Moses <gh@wsmoses.com>
Mon, 7 Jun 2021 17:44:07 +0000 (13:44 -0400)
committerWilliam S. Moses <gh@wsmoses.com>
Tue, 8 Jun 2021 15:43:09 +0000 (11:43 -0400)
commit965ad79ea7d0b98f905a27785a6fd0091b904218
tree5a408eb090016cf072a0305e50bdc8202431cbc5
parent49454ebc56ecf8b11f4b6c328c9fdb7b92307684
[MLIR][MemRef] Only allow fold of cast for the pointer operand, not the value

Currently canonicalizations of a store and a cast try to fold all casts into the store.

In the case where the operand being stored is itself a cast, this is illegal as the type of the value being stored
will change. This PR fixes this by not checking the value for folding with a cast.

Depends on https://reviews.llvm.org/D103828

Differential Revision: https://reviews.llvm.org/D103829
mlir/lib/Dialect/Affine/IR/AffineOps.cpp
mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp
mlir/test/Dialect/Affine/canonicalize.mlir
mlir/test/Dialect/MemRef/canonicalize.mlir