brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.4 KiB · a30aa44 Raw
194 lines · plain
1// RUN: mlir-opt -allow-unregistered-dialect -split-input-file %s -verify-diagnostics2 3func.func @unsupported_attribute() {4  // expected-error @+1 {{invalid kind of attribute specified}}5  %0 = constant "" : index6  return7}8 9// -----10 11func.func private @return_i32_f32() -> (i32, f32)12 13func.func @call() {14  // expected-error @+3 {{op result type mismatch at index 0}}15  // expected-note @+2 {{op result types: 'f32', 'i32'}}16  // expected-note @+1 {{function result types: 'i32', 'f32'}}17  %0:2 = call @return_i32_f32() : () -> (f32, i32)18  return19}20 21// -----22 23func.func @resulterror() -> i32 {24^bb42:25  return    // expected-error {{'func.return' op has 0 operands, but enclosing function (@resulterror) returns 1}}26}27 28// -----29 30func.func @return_type_mismatch() -> i32 {31  %0 = "foo"() : ()->f3232  return %0 : f32  // expected-error {{type of return operand 0 ('f32') doesn't match function result type ('i32') in function @return_type_mismatch}}33}34 35// -----36 37func.func @return_inside_loop() {38  affine.for %i = 1 to 100 {39    // expected-error@+1 {{'func.return' op expects parent op 'func.func'}}40    func.return41  }42  return43}44 45// -----46 47// expected-error@+1 {{expected non-function type}}48func.func @func_variadic(...)49 50// -----51 52func.func @foo() {53^bb0:54  %x = constant @foo : (i32) -> ()  // expected-error {{reference to function with mismatched type}}55  return56}57 58// -----59 60func.func @undefined_function() {61^bb0:62  %x = constant @qux : (i32) -> ()  // expected-error {{reference to undefined function 'qux'}}63  return64}65 66// -----67 68#map1 = affine_map<(i)[j] -> (i+j)>69 70func.func @bound_symbol_mismatch(%N : index) {71  affine.for %i = #map1(%N) to 100 {72  // expected-error@-1 {{symbol operand count and affine map symbol count must match}}73  }74  return75}76 77// -----78 79#map1 = affine_map<(i)[j] -> (i+j)>80 81func.func @bound_dim_mismatch(%N : index) {82  affine.for %i = #map1(%N, %N)[%N] to 100 {83  // expected-error@-1 {{dim operand count and affine map dim count must match}}84  }85  return86}87 88// -----89 90func.func @large_bound() {91  affine.for %i = 1 to 9223372036854775810 {92  // expected-error@-1 {{integer constant out of range for attribute}}93  }94  return95}96 97// -----98 99func.func @max_in_upper_bound(%N : index) {100  affine.for %i = 1 to max affine_map<(i)->(N, 100)> { //expected-error {{expected attribute value}}101  }102  return103}104 105// -----106 107func.func @step_typo() {108  affine.for %i = 1 to 100 step -- 1 { //expected-error {{expected constant integer}}109  }110  return111}112 113// -----114 115func.func @invalid_bound_map(%N : i32) {116  affine.for %i = 1 to affine_map<(i)->(j)>(%N) { //expected-error {{use of undeclared identifier}}117  }118  return119}120 121// -----122 123// expected-error @+1 {{expected '(' in integer set constraint list}}124#set0 = affine_set<(i)[N, M] : )i >= 0)>125 126// -----127#set0 = affine_set<(i)[N] : (i >= 0, N - i >= 0)>128 129func.func @invalid_if_operands1(%N : index) {130  affine.for %i = 1 to 10 {131    affine.if #set0(%i) {132    // expected-error@-1 {{symbol operand count and integer set symbol count must match}}133 134// -----135#set0 = affine_set<(i)[N] : (i >= 0, N - i >= 0)>136 137func.func @invalid_if_operands2(%N : index) {138  affine.for %i = 1 to 10 {139    affine.if #set0()[%N] {140    // expected-error@-1 {{dim operand count and integer set dim count must match}}141 142// -----143#set0 = affine_set<(i)[N] : (i >= 0, N - i >= 0)>144 145func.func @invalid_if_operands3(%N : index) {146  affine.for %i = 1 to 10 {147    affine.if #set0(%i)[%i] {148    // expected-error@-1 {{operand cannot be used as a symbol}}149    }150  }151  return152}153 154// -----155 156func.func @redundant_signature(%a : i32) -> () {157^bb0(%b : i32):  // expected-error {{invalid block name in region with named arguments}}158  return159}160 161// -----162 163func.func @mixed_named_arguments(%a : i32,164                               f32) -> () {165    // expected-error @-1 {{expected SSA identifier}}166  return167}168 169// -----170 171func.func @mixed_named_arguments(f32,172                               %a : i32) -> () { // expected-error {{expected type instead of SSA identifier}}173  return174}175 176// -----177 178// expected-error @+1 {{@ identifier expected to start with letter or '_'}}179func.func @$invalid_function_name()180 181// -----182 183// expected-error @+1 {{arguments may only have dialect attributes}}184func.func private @invalid_func_arg_attr(i1 {non_dialect_attr = 10})185 186// -----187 188// expected-error @+1 {{results may only have dialect attributes}}189func.func private @invalid_func_result_attr() -> (i1 {non_dialect_attr = 10})190 191// -----192 193func.func @foo() {} // expected-error {{expected non-empty function body}}194