| 1 |
; RUN: %lli -jit-kind=mcjit -remote-mcjit -disable-lazy-compilation=false -mcjit-remote-process=lli-child-target %s |
| 2 |
; XFAIL: target={{.*-windows-(gnu|msvc)}} |
| 3 |
; REQUIRES: thread_support |
| 4 |
; UNSUPPORTED: target=powerpc64-unknown-linux-gnu |
| 5 |
; Remove UNSUPPORTED for powerpc64-unknown-linux-gnu if problem caused by r266663 is fixed |
| 6 |
|
| 7 |
define i32 @main() nounwind { |
| 8 |
entry: |
| 9 |
call void @lazily_compiled_address_is_consistent() |
| 10 |
ret i32 0 |
| 11 |
} |
| 12 |
|
| 13 |
; Test PR3043: @test should have the same address before and after |
| 14 |
; it's JIT-compiled. |
| 15 |
@funcPtr = common global ptr null, align 4 |
| 16 |
@lcaic_failure = internal constant [46 x i8] c"@lazily_compiled_address_is_consistent failed\00" |
| 17 |
|
| 18 |
define void @lazily_compiled_address_is_consistent() nounwind { |
| 19 |
entry: |
| 20 |
store ptr @test, ptr @funcPtr |
| 21 |
%pass = tail call i1 @test() ; <i32> [#uses=1] |
| 22 |
br i1 %pass, label %pass_block, label %fail_block |
| 23 |
pass_block: |
| 24 |
ret void |
| 25 |
fail_block: |
| 26 |
call i32 @puts(ptr @lcaic_failure) |
| 27 |
call void @exit(i32 1) |
| 28 |
unreachable |
| 29 |
} |
| 30 |
|
| 31 |
define i1 @test() nounwind { |
| 32 |
entry: |
| 33 |
%tmp = load ptr, ptr @funcPtr |
| 34 |
%eq = icmp eq ptr %tmp, @test |
| 35 |
ret i1 %eq |
| 36 |
} |
| 37 |
|
| 38 |
declare i32 @puts(ptr) noreturn |
| 39 |
declare void @exit(i32) noreturn |