xref: /llvm-project/llvm/test/ExecutionEngine/MCJIT/remote/stubs-remote.ll (revision 5950a0623753a629814346ebadabbcda0ca2bdee)
1; RUN: %lli -jit-kind=mcjit -remote-mcjit -disable-lazy-compilation=false -mcjit-remote-process=lli-child-target%exeext %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
7define i32 @main() nounwind {
8entry:
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
18define void @lazily_compiled_address_is_consistent() nounwind {
19entry:
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
23pass_block:
24	ret void
25fail_block:
26	call i32 @puts(ptr @lcaic_failure)
27	call void @exit(i32 1)
28	unreachable
29}
30
31define i1 @test() nounwind {
32entry:
33	%tmp = load ptr, ptr @funcPtr
34	%eq = icmp eq ptr %tmp, @test
35	ret i1 %eq
36}
37
38declare i32 @puts(ptr) noreturn
39declare void @exit(i32) noreturn
40