An `unrealized_conversion_cast` operation represents an unrealized conversion from one set of types to another, that is used to enable the inter-mixing of different type systems. This operation should not be attributed any special representational or execution semantics, and is generally only intended to be used to satisfy the temporary intermixing of type systems during the conversion of one type system to another. This operation was discussed in the following RFC(and ODM): https://llvm.discourse.group/t/open-meeting-1-14-dialect-conversion-and-type-conversion-the-question-of-cast-operations/ Differential Revision: https://reviews.llvm.org/D94832
21 lines
910 B
MLIR
21 lines
910 B
MLIR
// RUN: mlir-opt %s -allow-unregistered-dialect | mlir-opt -allow-unregistered-dialect
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// UnrealizedConversionCastOp
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
%operand = "foo.op"() : () -> !foo.type
|
|
%tuple_operand = "foo.op"() : () -> !foo.tuple_type<!foo.type, !foo.type>
|
|
|
|
// An unrealized 0-1 conversion.
|
|
%result = unrealized_conversion_cast to !bar.tuple_type<>
|
|
|
|
// An unrealized 1-1 conversion.
|
|
%result1 = unrealized_conversion_cast %operand : !foo.type to !bar.lowered_type
|
|
|
|
// An unrealized 1-N conversion.
|
|
%results2:2 = unrealized_conversion_cast %tuple_operand : !foo.tuple_type<!foo.type, !foo.type> to !foo.type, !foo.type
|
|
|
|
// An unrealized N-1 conversion.
|
|
%result3 = unrealized_conversion_cast %operand, %operand : !foo.type, !foo.type to !bar.tuple_type<!foo.type, !foo.type>
|