brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.5 KiB · 79725a9 Raw
113 lines · plain
1// RUN: mlir-opt -split-input-file -allow-unregistered-dialect -verify-diagnostics %s2 3ml_program.func @ssa_enforced(%arg0 : i32) -> i32 {4  // expected-error @+1 {{does not dominate this use}}5  %1 = "unregistered.dummy"(%0) : (i32) -> i326  // expected-note @+1 {{operand defined here}}7  %0 = "unregistered.dummy"(%arg0) : (i32) -> i328  ml_program.return %0 : i329}10 11// -----12ml_program.func @return_arity_match(%arg0 : i32) -> i32 {13  // expected-error @+1 {{enclosing function (@return_arity_match) returns 1}}14  ml_program.return %arg0, %arg0 : i32, i3215}16 17// -----18ml_program.func @return_type_match(%arg0 : i64) -> i32 {19  // expected-error @+1 {{doesn't match function result}}20  ml_program.return %arg0 : i6421}22 23// -----24ml_program.subgraph @output_arity_match(%arg0 : i32) -> i32 {25  // expected-error @+1 {{enclosing function (@output_arity_match) outputs 1}}26  ml_program.output %arg0, %arg0 : i32, i3227}28 29// -----30ml_program.subgraph @output_type_match(%arg0 : i64) -> i32 {31  // expected-error @+1 {{doesn't match function result}}32  ml_program.output %arg0 : i6433}34 35// -----36// expected-error @+1 {{immutable global must have an initial value}}37ml_program.global private @const : i3238 39// -----40ml_program.func @undef_global() -> i32 {41  // expected-error @+1 {{undefined global: @nothere}}42  %0 = ml_program.global_load_const @nothere : i3243  ml_program.return %0 : i3244}45 46// -----47ml_program.global private mutable @var : i3248ml_program.func @mutable_const_load() -> i32 {49  // expected-error @+1 {{op cannot load as const from mutable global @var}}50  %0 = ml_program.global_load_const @var : i3251  ml_program.return %0 : i3252}53 54// -----55ml_program.global private @var(42 : i64) : i6456ml_program.func @const_load_type_mismatch() -> i32 {57  // expected-error @+1 {{cannot load from global typed 'i64' as 'i32'}}58  %0 = ml_program.global_load_const @var : i3259  ml_program.return %0 : i3260}61 62// -----63ml_program.func @load_undef() -> i32 {64  // expected-error @+1 {{undefined global: @nothere}}65  %0 = ml_program.global_load @nothere : i3266  ml_program.return %0 : i3267}68 69// -----70ml_program.global private mutable @var(42 : i64) : i6471ml_program.func @load_type_mismatch() -> i32 {72  // expected-error @+1 {{cannot load from global typed 'i64' as 'i32'}}73  %0 = ml_program.global_load @var : i3274  ml_program.return %0 : i3275}76 77// -----78ml_program.func @store_undef(%arg0: i32) {79  // expected-error @+1 {{undefined global: @nothere}}80  ml_program.global_store @nothere = %arg0 : i3281  ml_program.return82}83 84// -----85ml_program.global private mutable @var(42 : i64) : i6486ml_program.func @store_type_mismatch(%arg0: i32) {87  // expected-error @+1 {{cannot store to a global typed 'i64' from 'i32'}}88  ml_program.global_store @var = %arg0 : i3289  ml_program.return90}91 92// -----93ml_program.global private @var(42 : i64) : i6494ml_program.func @store_immutable(%arg0: i64) {95  // expected-error @+1 {{cannot store to an immutable global @var}}96  ml_program.global_store @var = %arg0 : i6497  ml_program.return98}99 100// -----101 102ml_program.global private mutable @global_mutable_undef : tensor<?xi32>103ml_program.subgraph @global_load_store_tokens() -> (tensor<?xi32>, !ml_program.token) {104  %token1 = ml_program.token105  %0, %token2 = ml_program.global_load_graph @global_mutable_undef106      ordering(() -> !ml_program.token) : tensor<?xi32>107  %token3 = ml_program.global_store_graph @global_mutable_undef = %0108  // expected-error @+1 {{expected '->'}}109      ordering(%token1, %token2) : tensor<?xi32>110 111  ml_program.output %0, %token3 : tensor<?xi32>, !ml_program.token112}113