xref: /llvm-project/llvm/test/ExecutionEngine/MCJIT/weak-function.ll (revision 2d56d8c4e8751c7e2cab927cdeb4e519af3f3585)
1; RUN: lli -jit-kind=mcjit -extra-module %p/Inputs/weak-function-2.ll %s
2; RUN: lli -extra-module %p/Inputs/weak-function-2.ll %s
3; UNSUPPORTED: uses_COFF
4;
5; Check that functions in two different modules agree on the address of weak
6; function 'baz'
7; Testing on COFF platforms is disabled as COFF has no representation of 'weak'
8; linkage.
9
10define weak i32 @baz() {
11entry:
12  ret i32 0
13}
14
15define ptr @foo() {
16entry:
17  ret ptr @baz
18}
19
20declare ptr @bar()
21
22define i32 @main(i32 %argc, ptr %argv) {
23entry:
24  %call = tail call ptr @foo()
25  %call1 = tail call ptr @bar()
26  %cmp = icmp ne ptr %call, %call1
27  %conv = zext i1 %cmp to i32
28  ret i32 %conv
29}
30
31