xref: /aosp_15_r20/external/llvm/test/ExecutionEngine/MCJIT/remote/stubs-remote.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: %lli -remote-mcjit -disable-lazy-compilation=false -mcjit-remote-process=lli-child-target%exeext %s
2*9880d681SAndroid Build Coastguard Worker; XFAIL: mingw32,win32
3*9880d681SAndroid Build Coastguard Worker; UNSUPPORTED: powerpc64-unknown-linux-gnu
4*9880d681SAndroid Build Coastguard Worker; Remove UNSUPPORTED for powerpc64-unknown-linux-gnu if problem caused by r266663 is fixed
5*9880d681SAndroid Build Coastguard Worker
6*9880d681SAndroid Build Coastguard Workerdefine i32 @main() nounwind {
7*9880d681SAndroid Build Coastguard Workerentry:
8*9880d681SAndroid Build Coastguard Worker	call void @lazily_compiled_address_is_consistent()
9*9880d681SAndroid Build Coastguard Worker	ret i32 0
10*9880d681SAndroid Build Coastguard Worker}
11*9880d681SAndroid Build Coastguard Worker
12*9880d681SAndroid Build Coastguard Worker; Test PR3043: @test should have the same address before and after
13*9880d681SAndroid Build Coastguard Worker; it's JIT-compiled.
14*9880d681SAndroid Build Coastguard Worker@funcPtr = common global i1 ()* null, align 4
15*9880d681SAndroid Build Coastguard Worker@lcaic_failure = internal constant [46 x i8] c"@lazily_compiled_address_is_consistent failed\00"
16*9880d681SAndroid Build Coastguard Worker
17*9880d681SAndroid Build Coastguard Workerdefine void @lazily_compiled_address_is_consistent() nounwind {
18*9880d681SAndroid Build Coastguard Workerentry:
19*9880d681SAndroid Build Coastguard Worker	store i1 ()* @test, i1 ()** @funcPtr
20*9880d681SAndroid Build Coastguard Worker	%pass = tail call i1 @test()		; <i32> [#uses=1]
21*9880d681SAndroid Build Coastguard Worker	br i1 %pass, label %pass_block, label %fail_block
22*9880d681SAndroid Build Coastguard Workerpass_block:
23*9880d681SAndroid Build Coastguard Worker	ret void
24*9880d681SAndroid Build Coastguard Workerfail_block:
25*9880d681SAndroid Build Coastguard Worker	call i32 @puts(i8* getelementptr([46 x i8], [46 x i8]* @lcaic_failure, i32 0, i32 0))
26*9880d681SAndroid Build Coastguard Worker	call void @exit(i32 1)
27*9880d681SAndroid Build Coastguard Worker	unreachable
28*9880d681SAndroid Build Coastguard Worker}
29*9880d681SAndroid Build Coastguard Worker
30*9880d681SAndroid Build Coastguard Workerdefine i1 @test() nounwind {
31*9880d681SAndroid Build Coastguard Workerentry:
32*9880d681SAndroid Build Coastguard Worker	%tmp = load i1 ()*, i1 ()** @funcPtr
33*9880d681SAndroid Build Coastguard Worker	%eq = icmp eq i1 ()* %tmp, @test
34*9880d681SAndroid Build Coastguard Worker	ret i1 %eq
35*9880d681SAndroid Build Coastguard Worker}
36*9880d681SAndroid Build Coastguard Worker
37*9880d681SAndroid Build Coastguard Workerdeclare i32 @puts(i8*) noreturn
38*9880d681SAndroid Build Coastguard Workerdeclare void @exit(i32) noreturn
39