| OLD | NEW |
| 1 ; RUN: pnacl-abicheck < %s | FileCheck %s | 1 ; RUN: pnacl-abicheck < %s | FileCheck %s |
| 2 | 2 |
| 3 ; This test checks that the PNaCl ABI verifier enforces the normal | 3 ; This test checks that the PNaCl ABI verifier enforces the normal |
| 4 ; form introduced by the ReplacePtrsWithInts pass. | 4 ; form introduced by the ReplacePtrsWithInts pass. |
| 5 | 5 |
| 6 | 6 |
| 7 @var = global [4 x i8] c"xxxx" | 7 @var = global [4 x i8] c"xxxx" |
| 8 @ptr = global i32 ptrtoint ([4 x i8]* @var to i32) | 8 @ptr = global i32 ptrtoint ([4 x i8]* @var to i32) |
| 9 | 9 |
| 10 declare i8* @llvm.nacl.read.tp() | 10 declare i8* @llvm.nacl.read.tp() |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 | 34 |
| 35 ptrtoint [4 x i8]* @var to i32 | 35 ptrtoint [4 x i8]* @var to i32 |
| 36 | 36 |
| 37 %alloc = alloca i8 | 37 %alloc = alloca i8 |
| 38 ptrtoint i8* %alloc to i32 | 38 ptrtoint i8* %alloc to i32 |
| 39 load i8* %alloc, align 1 | 39 load i8* %alloc, align 1 |
| 40 | 40 |
| 41 ; These instructions may use a NormalizedPtr, which may be a global. | 41 ; These instructions may use a NormalizedPtr, which may be a global. |
| 42 load i32* @ptr, align 1 | 42 load i32* @ptr, align 1 |
| 43 store i32 123, i32* @ptr, align 1 | 43 store i32 123, i32* @ptr, align 1 |
| 44 cmpxchg i32* @ptr, i32 1, i32 2 seq_cst | |
| 45 atomicrmw add i32* @ptr, i32 3 seq_cst | |
| 46 | 44 |
| 47 ; A NormalizedPtr may be a bitcast. | 45 ; A NormalizedPtr may be a bitcast. |
| 48 %ptr_bitcast = bitcast [4 x i8]* @var to i32* | 46 %ptr_bitcast = bitcast [4 x i8]* @var to i32* |
| 49 load i32* %ptr_bitcast, align 1 | 47 load i32* %ptr_bitcast, align 1 |
| 50 | 48 |
| 51 ; A NormalizedPtr may be an inttoptr. | 49 ; A NormalizedPtr may be an inttoptr. |
| 52 %ptr_from_int = inttoptr i32 123 to i32* | 50 %ptr_from_int = inttoptr i32 123 to i32* |
| 53 load i32* %ptr_from_int, align 1 | 51 load i32* %ptr_from_int, align 1 |
| 54 | 52 |
| 55 ; Check direct and indirect function calls. | 53 ; Check direct and indirect function calls. |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 ; CHECK-NEXT: bad operand | 123 ; CHECK-NEXT: bad operand |
| 126 | 124 |
| 127 ; Taking the address of an intrinsic is not allowed. | 125 ; Taking the address of an intrinsic is not allowed. |
| 128 ptrtoint i8* ()* @llvm.nacl.read.tp to i32 | 126 ptrtoint i8* ()* @llvm.nacl.read.tp to i32 |
| 129 ; CHECK-NEXT: operand not InherentPtr | 127 ; CHECK-NEXT: operand not InherentPtr |
| 130 | 128 |
| 131 ret void | 129 ret void |
| 132 } | 130 } |
| 133 | 131 |
| 134 ; CHECK-NOT: disallowed | 132 ; CHECK-NOT: disallowed |
| OLD | NEW |