1target triple = "wasm32-unknown-unknown"
2
3; Function Attrs: norecurse nounwind readnone
4define i32 @direct_fn() #0 {
5entry:
6  ret i32 0
7}
8
9@alias_fn = weak alias i32 (), i32 ()* @direct_fn
10
11define i32 @call_direct() #0 {
12entry:
13  %call = call i32 @direct_fn()
14  ret i32 %call
15}
16
17define i32 @call_alias() #0 {
18entry:
19  %call = call i32 @alias_fn()
20  ret i32 %call
21}
22
23define i32 @call_alias_ptr() #0 {
24entry:
25   %fnptr = alloca i32 ()*, align 8
26   store i32 ()* @alias_fn, i32 ()** %fnptr, align 8
27   %0 = load i32 ()*, i32 ()** %fnptr, align 8
28   %call = call i32 %0()
29   ret i32 %call
30}
31
32define i32 @call_direct_ptr() #0 {
33entry:
34  %fnptr = alloca i32 ()*, align 8
35  store i32 ()* @direct_fn, i32 ()** %fnptr, align 8
36  %0 = load i32 ()*, i32 ()** %fnptr, align 8
37  %call = call i32 %0()
38  ret i32 %call
39}
40