Skip to content

Commit

Permalink
[CIR][NFC] Add negative test cases for verifier
Browse files Browse the repository at this point in the history
  • Loading branch information
seven-mile committed Jun 4, 2024
1 parent a23f9ed commit 71e72a9
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions clang/test/CIR/IR/invalid.cir
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,31 @@ cir.func @cast24(%p : !u32i) {

// -----

!u32i = !cir.int<u, 32>
!u64i = !cir.int<u, 64>
cir.func @cast25(%p : !cir.ptr<!u32i, addrspace(1)>) {
%0 = cir.cast(address_space, %p : !cir.ptr<!u32i, addrspace(1)>), !cir.ptr<!u64i, addrspace(2)> // expected-error {{requires two types differ in addrspace only}}
cir.return
}

// -----

!u64i = !cir.int<u, 64>
cir.func @cast26(%p : !cir.ptr<!u64i, addrspace(1)>) {
%0 = cir.cast(address_space, %p : !cir.ptr<!u64i, addrspace(1)>), !u64i // expected-error {{requires !cir.ptr type for source and result}}
cir.return
}

// -----

!u64i = !cir.int<u, 64>
cir.func @cast27(%p : !u64i) {
%0 = cir.cast(address_space, %p : !u64i), !cir.ptr<!u64i, addrspace(1)> // expected-error {{requires !cir.ptr type for source and result}}
cir.return
}

// -----

!u32i = !cir.int<u, 32>
!u8i = !cir.int<u, 8>
module {
Expand Down

0 comments on commit 71e72a9

Please sign in to comment.