OLD | NEW |
1 ; Test that the writer elides an inttoptr of a ptrtoint. | 1 ; Test that the writer elides an inttoptr of a ptrtoint. |
2 | 2 |
3 ; RUN: llvm-as < %s | pnacl-freeze \ | 3 ; RUN: llvm-as < %s | pnacl-freeze \ |
4 ; RUN: | pnacl-bcanalyzer -dump-records \ | 4 ; RUN: | pnacl-bcanalyzer -dump-records \ |
5 ; RUN: | FileCheck %s -check-prefix=PF2 | 5 ; RUN: | FileCheck %s -check-prefix=PF2 |
6 | 6 |
7 ; RUN: llvm-as < %s | pnacl-freeze | pnacl-thaw \ | 7 ; RUN: llvm-as < %s | pnacl-freeze | pnacl-thaw \ |
8 ; RUN: | llvm-dis - | FileCheck %s -check-prefix=TD2 | 8 ; RUN: | llvm-dis - | FileCheck %s -check-prefix=TD2 |
9 | 9 |
10 | 10 |
11 @bytes = internal global [4 x i8] c"abcd" | 11 @bytes = internal global [4 x i8] c"abcd" |
12 | 12 |
13 define void @inttoptr_of_ptrtoint() { | 13 define void @inttoptr_of_ptrtoint() { |
14 ; These two instructions are usually replaced with an equivalent | 14 ; These two instructions are usually replaced with an equivalent |
15 ; bitcast, but either sequence is allowed by the PNaCl ABI verifier. | 15 ; bitcast, but either sequence is allowed by the PNaCl ABI verifier. |
16 %1 = ptrtoint [4 x i8]* @bytes to i32 | 16 %1 = ptrtoint [4 x i8]* @bytes to i32 |
17 %2 = inttoptr i32 %1 to i8* | 17 %2 = inttoptr i32 %1 to i8* |
18 load i8* %2 | 18 load i8, i8* %2 |
19 ret void | 19 ret void |
20 } | 20 } |
21 | 21 |
22 ; TD2: define void @inttoptr_of_ptrtoint() { | 22 ; TD2: define void @inttoptr_of_ptrtoint() { |
23 ; TD2-NEXT: %1 = bitcast [4 x i8]* @bytes to i8* | 23 ; TD2-NEXT: %1 = bitcast [4 x i8]* @bytes to i8* |
24 ; TD2-NEXT: %2 = load i8* %1 | 24 ; TD2-NEXT: %2 = load i8, i8* %1 |
25 ; TD2-NEXT: ret void | 25 ; TD2-NEXT: ret void |
26 ; TD2-NEXT: } | 26 ; TD2-NEXT: } |
27 | 27 |
28 ; PF2: <FUNCTION_BLOCK> | 28 ; PF2: <FUNCTION_BLOCK> |
29 ; PF2-NEXT: <DECLAREBLOCKS op0=1/> | 29 ; PF2-NEXT: <DECLAREBLOCKS op0=1/> |
30 ; PF2-NEXT: <INST_LOAD {{.*}}/> | 30 ; PF2-NEXT: <INST_LOAD {{.*}}/> |
31 ; PF2-NEXT: <INST_RET/> | 31 ; PF2-NEXT: <INST_RET/> |
32 ; PF2: </FUNCTION_BLOCK> | 32 ; PF2: </FUNCTION_BLOCK> |
OLD | NEW |