[MLIR][Shape] Lower `shape.get_extent` to `std.dim` when possible
authorFrederik Gossen <frgossen@google.com>
Mon, 29 Jun 2020 08:17:00 +0000 (08:17 +0000)
committerFrederik Gossen <frgossen@google.com>
Mon, 29 Jun 2020 08:38:22 +0000 (08:38 +0000)
commit76d72c941df19779a7abfdfda66d3f452cef1db8
tree73e7a184d2c0e146086d31310f3322cdeb90b20c
parent37cc4fa2eaa3d03ca8cd4947eb0d4c60e3c9b45c
[MLIR][Shape] Lower `shape.get_extent` to `std.dim` when possible

When the shape is derived from a tensor argument the shape extent can be derived
directly from that tensor with `std.dim`.
This lowering pattern circumvents the necessity to materialize the shape in
memory.

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