[all-commits] [llvm/llvm-project] a0b210: [mlir] Use TypedValue in single result traits
rk via All-commits
all-commits at lists.llvm.org
Wed Feb 1 18:55:06 PST 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: a0b21046d8a3891b36fc992d97bc9daf4b3ce385
https://github.com/llvm/llvm-project/commit/a0b21046d8a3891b36fc992d97bc9daf4b3ce385
Author: Rahul Kayaith <rkayaith at gmail.com>
Date: 2023-02-01 (Wed, 01 Feb 2023)
Changed paths:
M mlir/include/mlir/IR/OpDefinition.h
M mlir/test/lib/Dialect/Test/TestPatterns.cpp
Log Message:
-----------
[mlir] Use TypedValue in single result traits
Ops with a single result currently get a `getResult()` method +
conversion operator to `Value` through the `OneResult` trait. By moving
these to the `OneTypedResult` trait instead, we can use `TypedValue` as
the return type to get more specfic types.
When the result type is unknown ODS adds the
`OneTypedResult<mlir::Type>` trait, in which case there is no change in
the resulting API.
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D142852
Commit: 0ce25b12357b24d06cf08cc02719c144d567d5db
https://github.com/llvm/llvm-project/commit/0ce25b12357b24d06cf08cc02719c144d567d5db
Author: Rahul Kayaith <rkayaith at gmail.com>
Date: 2023-02-01 (Wed, 01 Feb 2023)
Changed paths:
M mlir/docs/Tutorials/Toy/Ch-4.md
M mlir/examples/toy/Ch4/mlir/Dialect.cpp
M mlir/examples/toy/Ch5/mlir/Dialect.cpp
M mlir/examples/toy/Ch6/mlir/Dialect.cpp
M mlir/examples/toy/Ch7/mlir/Dialect.cpp
M mlir/include/mlir/IR/OpDefinition.h
M mlir/include/mlir/IR/Value.h
M mlir/include/mlir/TableGen/Class.h
M mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp
M mlir/lib/Conversion/VectorToSCF/VectorToSCF.cpp
M mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorRewriting.cpp
M mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorStorageLayout.h
M mlir/test/mlir-tblgen/op-operand.td
M mlir/test/mlir-tblgen/op-result.td
M mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
M mlir/unittests/IR/IRMapping.cpp
Log Message:
-----------
[mlir] Require explicit casts when using TypedValue
Currently `TypedValue` can be constructed directly from `Value`, hiding
errors that could be caught at compile time. For example the following
will compile, but crash/assert at runtime:
```
void foo(TypedValue<IntegerType>);
void bar(TypedValue<FloatType> v) {
foo(v);
}
```
This change removes the constructors and replaces them with explicit
llvm casts.
Depends on D142852
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D142855
Compare: https://github.com/llvm/llvm-project/compare/df9500c29531...0ce25b12357b
More information about the All-commits
mailing list