[mlir][ods] Generate inferReturnTypes for ops with TypesMatchWith
authorJeff Niu <jeff@modular.com>
Sun, 8 Jan 2023 20:46:52 +0000 (12:46 -0800)
committerJeff Niu <jeff@modular.com>
Thu, 12 Jan 2023 21:26:12 +0000 (13:26 -0800)
commit1b60f0d73c34fec4648bb05f98db75008a50f4d8
treee27c4485cf73ab343ebf0f5441832e126aaa5c3b
parent27cf96c4ec4a2a2906fef7479341c5b9d8616887
[mlir][ods] Generate inferReturnTypes for ops with TypesMatchWith

Ops that use TypesMatchWith to constrain result types for verification
and to infer result types during parser generation should also be able
to have the `inferReturnTypes` method auto generated. This patch
upgrades the logic for generating `inferReturnTypes` to handle the
TypesMatchWith trait by building a type inference graph where each edge
corresponds to "type of A can be inferred from type of B", supporting
transformers other than `"$_self"`.

Reviewed By: lattner, rriddle

Differential Revision: https://reviews.llvm.org/D141231
16 files changed:
mlir/include/mlir/Dialect/Arith/IR/ArithOps.td
mlir/include/mlir/Dialect/Bufferization/IR/BufferizationOps.td
mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td
mlir/include/mlir/Dialect/SPIRV/IR/SPIRVLogicalOps.td
mlir/include/mlir/Dialect/Tensor/IR/TensorOps.td
mlir/include/mlir/Dialect/Vector/IR/VectorOps.td
mlir/include/mlir/TableGen/Operator.h
mlir/lib/Conversion/VectorToSCF/VectorToSCF.cpp
mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
mlir/lib/Dialect/SPIRV/IR/SPIRVOps.cpp
mlir/lib/Dialect/Vector/IR/VectorOps.cpp
mlir/lib/Dialect/Vector/Transforms/VectorTransferSplitRewritePatterns.cpp
mlir/lib/TableGen/Operator.cpp
mlir/test/mlir-tblgen/op-result.td
mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp