Files
clang-p2996/mlir/test/Transforms/test-dialect-conversion-pdll.mlir
River Riddle 8c66344ee9 [mlir:PDL] Add support for DialectConversion with pattern configurations
Up until now PDL(L) has not supported dialect conversion because we had no
way of remapping values or integrating with type conversions. This commit
rectifies that by adding a new "pattern configuration" concept to PDL. This
essentially allows for attaching external configurations to patterns, which
can hook into pattern events (for now just the scope of a rewrite, but we
could also pass configs to native rewrites as well). This allows for injecting
the type converter into the conversion pattern rewriter.

Differential Revision: https://reviews.llvm.org/D133142
2022-11-08 01:57:57 -08:00

19 lines
695 B
MLIR

// RUN: mlir-opt %s -test-dialect-conversion-pdll | FileCheck %s
// CHECK-LABEL: @TestSingleConversion
func.func @TestSingleConversion() {
// CHECK: %[[CAST:.*]] = "test.cast"() : () -> f64
// CHECK-NEXT: "test.return"(%[[CAST]]) : (f64) -> ()
%result = "test.cast"() : () -> (i64)
"test.return"(%result) : (i64) -> ()
}
// CHECK-LABEL: @TestLingeringConversion
func.func @TestLingeringConversion() -> i64 {
// CHECK: %[[ORIG_CAST:.*]] = "test.cast"() : () -> f64
// CHECK: %[[MATERIALIZE_CAST:.*]] = builtin.unrealized_conversion_cast %[[ORIG_CAST]] : f64 to i64
// CHECK-NEXT: return %[[MATERIALIZE_CAST]] : i64
%result = "test.cast"() : () -> (i64)
return %result : i64
}