1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
|
// RUN: mlir-opt %s -split-input-file -verify-diagnostics
func @const_attribute_return_type_1() {
// expected-error @+1 {{'emitc.constant' op requires attribute's type ('i64') to match op's return type ('i32')}}
%c0 = "emitc.constant"(){value = 42: i64} : () -> i32
return
}
// -----
func @const_attribute_return_type_2() {
// expected-error @+1 {{'emitc.constant' op requires attribute's type ('!emitc.opaque<"int32_t*">') to match op's return type ('!emitc.opaque<"int32_t">')}}
%c0 = "emitc.constant"(){value = "nullptr" : !emitc.opaque<"int32_t*">} : () -> !emitc.opaque<"int32_t">
return
}
// -----
func @index_args_out_of_range_1() {
// expected-error @+1 {{'emitc.call' op index argument is out of range}}
emitc.call "test" () {args = [0 : index]} : () -> ()
return
}
// -----
func @index_args_out_of_range_2(%arg : i32) {
// expected-error @+1 {{'emitc.call' op index argument is out of range}}
emitc.call "test" (%arg, %arg) {args = [2 : index]} : (i32, i32) -> ()
return
}
// -----
func @empty_callee() {
// expected-error @+1 {{'emitc.call' op callee must not be empty}}
emitc.call "" () : () -> ()
return
}
// -----
func @nonetype_arg(%arg : i32) {
// expected-error @+1 {{'emitc.call' op array argument has no type}}
emitc.call "nonetype_arg"(%arg) {args = [0 : index, [0, 1, 2]]} : (i32) -> i32
return
}
// -----
func @array_template_arg(%arg : i32) {
// expected-error @+1 {{'emitc.call' op template argument has invalid type}}
emitc.call "nonetype_template_arg"(%arg) {template_args = [[0, 1, 2]]} : (i32) -> i32
return
}
// -----
func @dense_template_argument(%arg : i32) {
// expected-error @+1 {{'emitc.call' op template argument has invalid type}}
emitc.call "dense_template_argument"(%arg) {template_args = [dense<[1.0, 1.0]> : tensor<2xf32>]} : (i32) -> i32
return
}
// -----
func @empty_operator(%arg : i32) {
// expected-error @+1 {{'emitc.apply' op applicable operator must not be empty}}
%2 = emitc.apply ""(%arg) : (i32) -> !emitc.opaque<"int32_t*">
return
}
// -----
func @illegal_operator(%arg : i32) {
// expected-error @+1 {{'emitc.apply' op applicable operator is illegal}}
%2 = emitc.apply "+"(%arg) : (i32) -> !emitc.opaque<"int32_t*">
return
}
|