[mlir][linalg] Fix dim(iter_arg) canonicalization
commitf7137da174a43dd5460b72a21fbcaac7b7b74d7a
authorMatthias Springer <springerm@google.com>
Thu, 9 Sep 2021 03:12:28 +0000 (9 12:12 +0900)
committerMatthias Springer <springerm@google.com>
Thu, 9 Sep 2021 03:13:05 +0000 (9 12:13 +0900)
tree240a3ba3063e264bcf968353c6fdd6767d821a1e
parent9da62d3ed9d7d8425acbaff13dfe65692db608f9
[mlir][linalg] Fix dim(iter_arg) canonicalization

Run a small analysis to see if the runtime type of the iter_arg is changing. Fold only if the runtime type stays the same. (Same as `DimOfIterArgFolder` in SCF.)

Differential Revision: https://reviews.llvm.org/D109299
mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
mlir/test/Dialect/Linalg/canonicalize.mlir