[all-commits] [llvm/llvm-project] c0261e: [mlir][IR] Improve `clone` function return type of...
Matthias Springer via All-commits
all-commits at lists.llvm.org
Thu May 25 00:27:51 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: c0261eb02bb092d8842d3c57297e23f31d75cb96
https://github.com/llvm/llvm-project/commit/c0261eb02bb092d8842d3c57297e23f31d75cb96
Author: Matthias Springer <me at m-sp.org>
Date: 2023-05-25 (Thu, 25 May 2023)
Changed paths:
M mlir/include/mlir/IR/BuiltinTypeInterfaces.td
M mlir/include/mlir/IR/BuiltinTypes.h
M mlir/include/mlir/IR/BuiltinTypes.td
M mlir/lib/IR/BuiltinTypes.cpp
Log Message:
-----------
[mlir][IR] Improve `clone` function return type of shaped types
There are `clone` overloads that take a shape as a parameter. These overloads are guaranteed to return a ranked shaped type.
`TensorType::clone`/`BaseMemRefType::clone` used to always return a `TensorType`/`BaseMemRefType`. The variants that take a shape parameter now return a `RankedTensorType`/`MemRefType`. Better static type information can make extra casts at the call site obsolete.
E.g.:
```
{TensorType/RankedTensorType} t;
t.clone({1, 2}) // now returns RankedTensorType instead of TensorType
```
Also improve documentation for `clone`.
Differential Revision: https://reviews.llvm.org/D150865
More information about the All-commits
mailing list