[mlir][tosa] Canonicalize concatenate->slice sequence
Adds a canonicalizer for the concatenate->slice sequence where
an output of slice can be replaced with an input of concatenate.
This is useful in the context of operations with complex inputs
and outputs that are legalized from a framework such as TFL.
For example, a TFL graph (FFT->FFT) will be legalized to the
following TOSA graph:
<complex input>
/ \
slice slice
\ /
FFT
/ \ -+
concatenate |
/ \ | Redundant
slice slice |
\ / -+
FFT
/ \
concatenate
|
<complex output>
Concatenate and slice operations at the boundaries of the graph are
useful as they maintain the correct correspondance of input/output
tensors to the original TFL graph. However, consecutive
complex operations will result in redundant concatenate->slice
sequences which should be removed from the final TOSA graph.
The canonicalization does not currently handle dynamic types.
Signed-off-by: Luke Hutton <luke.hutton@arm.com>
Reviewed By: rsuderman
Differential Revision: https://reviews.llvm.org/D144545