Skip to content

Commit 47fc018

Browse files
committed
[WebAssembly] Move call_indirect_alloca to call.ll
Not sure the distinction between `call.ll` and `call-indirect.ll`, because `call.ll` also seems to contain many `call_indirect` tests. Also before D147033 `call-indirect.ll` only contained a single test and it also tests it with `obj2yaml`, so I guess that file was created for testing functionalities for object files as well. We can probably merge these two someday. But anyway, this moves `call_indirect_alloca` I added in D147033 to `call.ll`, given that that file contains more `call_indirect` tests and I'm planning to add more `call_indirect` tests in a followup CL. Reviewed By: tlively Differential Revision: https://reviews.llvm.org/D147396
1 parent 93c194f commit 47fc018

File tree

2 files changed

+15
-21
lines changed

2 files changed

+15
-21
lines changed

llvm/test/CodeGen/WebAssembly/call-indirect.ll

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -18,33 +18,12 @@ define void @call_indirect_void(ptr %callee) {
1818
ret void
1919
}
2020

21-
; CHECK-LABEL: call_indirect_alloca:
22-
; CHECK-NEXT: .functype call_indirect_alloca () -> ()
23-
; CHECK: local.tee 0
24-
; CHECK-NEXT: global.set __stack_pointer
25-
; CHECK-NEXT: local.get 0
26-
; CHECK-NEXT: i32.const 12
27-
; CHECK-NEXT: i32.add
28-
; REF: call_indirect __indirect_function_table, () -> ()
29-
; NOREF: call_indirect () -> ()
30-
define void @call_indirect_alloca() {
31-
entry:
32-
%ptr = alloca i32, align 4
33-
call void %ptr()
34-
ret void
35-
}
36-
3721
; OBJ: Imports:
3822
; OBJ-NEXT: - Module: env
3923
; OBJ-NEXT: Field: __linear_memory
4024
; OBJ-NEXT: Kind: MEMORY
4125
; OBJ-NEXT: Memory:
4226
; OBJ-NEXT: Minimum: 0x0
4327
; OBJ-NEXT: - Module: env
44-
; OBJ-NEXT: Field: __stack_pointer
45-
; OBJ-NEXT: Kind: GLOBAL
46-
; OBJ-NEXT: GlobalType: I32
47-
; OBJ-NEXT: GlobalMutable: true
48-
; OBJ-NEXT: - Module: env
4928
; OBJ-NEXT: Field: __indirect_function_table
5029
; OBJ-NEXT: Kind: TABLE

llvm/test/CodeGen/WebAssembly/call.ll

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,21 @@ bb2:
236236
ret void
237237
}
238238

239+
; Allocas should be lowered to call_indirects.
240+
; CHECK-LABEL: call_indirect_alloca:
241+
; CHECK: local.tee $push{{.*}}=, [[L0:[0-9]+]]
242+
; CHECK-NEXT: global.set __stack_pointer
243+
; CHECK-NEXT: local.get $push{{.*}}=, [[L0]]
244+
; CHECK-NEXT: i32.const $push{{.*}}=, 12
245+
; CHECK-NEXT: i32.add
246+
; CHECK-NEXT: call_indirect $pop{{.*}}
247+
define void @call_indirect_alloca() {
248+
entry:
249+
%ptr = alloca i32, align 4
250+
call void %ptr()
251+
ret void
252+
}
253+
239254
; TODO: test the following:
240255
; - More argument combinations.
241256
; - Tail call.

0 commit comments

Comments
 (0)