[MLIR][Shape] Lower `shape.get_extent` to `extract_element` when possible
authorFrederik Gossen <frgossen@google.com>
Mon, 29 Jun 2020 08:14:15 +0000 (08:14 +0000)
committerFrederik Gossen <frgossen@google.com>
Mon, 29 Jun 2020 08:39:22 +0000 (08:39 +0000)
commitd876e3202af3057cc180d7540d0de8b20234f114
tree1bad445861608de6cdf19b3145b685fba6724a76
parent76d72c941df19779a7abfdfda66d3f452cef1db8
[MLIR][Shape] Lower `shape.get_extent` to `extract_element` when possible

When the origin of a shape is an extent tensor the operation `get_extent` can be
lowered directly to `extract_element`.
This choice circumvents the necessity to materialize the shape in memory.

Differential Revision: https://reviews.llvm.org/D82645
mlir/lib/Conversion/ShapeToStandard/ShapeToStandardPatterns.td
mlir/test/Conversion/ShapeToStandard/shape-to-standard.mlir