[linalg] When removing noop linalg.generics, check that inserting a cast is valid
authorBenjamin Kramer <benny.kra@googlemail.com>
Mon, 28 Mar 2022 12:10:26 +0000 (14:10 +0200)
committerBenjamin Kramer <benny.kra@googlemail.com>
Tue, 29 Mar 2022 21:05:54 +0000 (23:05 +0200)
commit35dab904c09b58f061c303b40b394c909ba84db6
tree7968d9fceba0135a4d9b0b99c0dfdda545f3ce34
parenta8ebd85e463b086c0e684c9e7867bbf42555ad27
[linalg] When removing noop linalg.generics, check that inserting a cast is valid

linalg.generic can also take scalars instead of tensors, which
tensor.cast doesn't support. We don't have an easy way to cast between
scalars and tensors so just keep the linalg.generic in those cases.

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