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