[mlir][std] Fold dim(dynamic_tensor_from_elements, %cst)
authorStephan Herhut <herhut@google.com>
Tue, 17 Nov 2020 12:39:08 +0000 (13:39 +0100)
committerStephan Herhut <herhut@google.com>
Tue, 17 Nov 2020 13:39:59 +0000 (14:39 +0100)
commit3598605c0b3658dbb6cac634cb92a0a131f2fe0b
tree95e2ef98fbf4889b1165899b49b04178db884c2f
parentffac5b8e4cc03cbc7ff6d53bb6bf0118dace8d55
[mlir][std] Fold dim(dynamic_tensor_from_elements, %cst)

The shape of the result of a dynamic_tensor_from_elements is defined via its
result type and operands. We already fold dim operations when they reference
one of the statically sized dimensions. Now, also fold dim on the dynamically
sized dimensions by picking the corresponding operand.

Differential Revision: https://reviews.llvm.org/D91616
mlir/lib/Dialect/StandardOps/IR/Ops.cpp
mlir/test/Dialect/Standard/canonicalize.mlir