[mlir][NFC] reifyResultShapes: Add extra error checking
authorMatthias Springer <me@m-sp.org>
Fri, 10 Mar 2023 10:25:15 +0000 (11:25 +0100)
committerMatthias Springer <me@m-sp.org>
Fri, 10 Mar 2023 10:37:54 +0000 (11:37 +0100)
commit758329dc7cd3b0da835a4f865b89003263050080
treed1ef7ed1904524b9d4f329ac57419d514f29ca1b
parent0a9f6b8ca3fa9449cc0accba1bc11e98d6dbc6b6
[mlir][NFC] reifyResultShapes: Add extra error checking

This change adds a new helper function `mlir::reifyResultShapes` that calls the corresponding interface method and also checks the result produced by the implementation when running in debug mode. Bugs due to incorrect interface implementations can be difficult to debug.

This helper function also reduces the amount of code needed at call sites: the cast to `ReifyRankedShapedTypeOpInterface` is done in the helper function.

Differential Revision: https://reviews.llvm.org/D145777
14 files changed:
mlir/include/mlir/Interfaces/InferTypeOpInterface.h
mlir/lib/Dialect/Bufferization/IR/BufferizableOpInterface.cpp
mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
mlir/lib/Dialect/Linalg/Transforms/ConvertToDestinationStyle.cpp
mlir/lib/Dialect/Linalg/Transforms/FusePadOpWithLinalgProducer.cpp
mlir/lib/Dialect/Linalg/Transforms/Transforms.cpp
mlir/lib/Dialect/MemRef/Transforms/ResolveShapedTypeResultDims.cpp
mlir/lib/Dialect/Tensor/IR/TensorOps.cpp
mlir/lib/Dialect/Tensor/IR/TensorTilingInterfaceImpl.cpp
mlir/lib/Dialect/Tensor/Transforms/EmptyOpPatterns.cpp
mlir/lib/Dialect/Tensor/Transforms/ExtractSliceFromReshapeUtils.cpp
mlir/lib/Interfaces/InferTypeOpInterface.cpp
mlir/test/lib/Dialect/Tensor/TestTensorTransforms.cpp
mlir/test/lib/Dialect/Test/TestDialect.cpp