| 1 |
// RUN: cir-opt %s -verify-diagnostics -split-input-file |
| 2 |
|
| 3 |
!u32i = !cir.int<u, 32> |
| 4 |
|
| 5 |
cir.func @f1() { |
| 6 |
// expected-error @below {{'f' does not reference a valid function}} |
| 7 |
cir.call @f() : () -> () |
| 8 |
cir.return |
| 9 |
} |
| 10 |
|
| 11 |
// ----- |
| 12 |
|
| 13 |
!u32i = !cir.int<u, 32> |
| 14 |
|
| 15 |
cir.func private @f2() |
| 16 |
cir.func @f3() { |
| 17 |
// expected-error @below {{callee returns void but call has results}} |
| 18 |
%0 = cir.call @f2() : () -> !u32i |
| 19 |
cir.return |
| 20 |
} |
| 21 |
|
| 22 |
// ----- |
| 23 |
|
| 24 |
!u32i = !cir.int<u, 32> |
| 25 |
|
| 26 |
cir.func private @f4() -> !u32i |
| 27 |
cir.func @f5() { |
| 28 |
// expected-error @below {{incorrect number of results for callee}} |
| 29 |
cir.call @f4() : () -> () |
| 30 |
cir.return |
| 31 |
} |
| 32 |
|
| 33 |
// ----- |
| 34 |
|
| 35 |
!s32i = !cir.int<s, 32> |
| 36 |
!u32i = !cir.int<u, 32> |
| 37 |
|
| 38 |
cir.func private @f6() -> !u32i |
| 39 |
cir.func @f7() { |
| 40 |
// expected-error @below {{result type mismatch}} |
| 41 |
%0 = cir.call @f6() : () -> !s32i |
| 42 |
cir.return |
| 43 |
} |
| 44 |
|
| 45 |
// ----- |
| 46 |
|
| 47 |
!s32i = !cir.int<s, 32> |
| 48 |
!u32i = !cir.int<u, 32> |
| 49 |
|
| 50 |
cir.func private @f8(!s32i, !s32i) |
| 51 |
cir.func @f9() { |
| 52 |
%0 = cir.const #cir.int<1> : !s32i |
| 53 |
// expected-error @below {{incorrect number of operands for callee}} |
| 54 |
cir.call @f8(%0) : (!s32i) -> () |
| 55 |
cir.return |
| 56 |
} |
| 57 |
|
| 58 |
// ----- |
| 59 |
|
| 60 |
!s32i = !cir.int<s, 32> |
| 61 |
!u32i = !cir.int<u, 32> |
| 62 |
|
| 63 |
cir.func private @f10(!s32i, !s32i) |
| 64 |
cir.func @f11() { |
| 65 |
%0 = cir.const #cir.int<1> : !s32i |
| 66 |
%1 = cir.const #cir.int<2> : !u32i |
| 67 |
// expected-error @below {{operand type mismatch: expected operand type '!cir.int<s, 32>', but provided '!cir.int<u, 32>' for operand number 1}} |
| 68 |
cir.call @f10(%0, %1) : (!s32i, !u32i) -> () |
| 69 |
cir.return |
| 70 |
} |
| 71 |
|
| 72 |
// ----- |
| 73 |
|
| 74 |
!s32i = !cir.int<s, 32> |
| 75 |
|
| 76 |
cir.func private @f12(!s32i, !s32i, ...) |
| 77 |
cir.func @f13() { |
| 78 |
%0 = cir.const #cir.int<1> : !s32i |
| 79 |
// expected-error @below {{too few operands for callee}} |
| 80 |
cir.call @f12(%0) : (!s32i) -> () |
| 81 |
cir.return |
| 82 |
} |