Skip to content

Commit dbc5900

Browse files
authored
[WebAssembly] Fix .functype directives in tests (#108748)
For defined functions, it appears `.functype` directive should be after the function label. Otherwise binary generation does not seem to work correctly. Also this fixes a case that the `.functype` directive's name is incorrect.
1 parent 0975e2a commit dbc5900

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

llvm/test/MC/WebAssembly/eh-assembly-legacy.s

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44

55
.tagtype __cpp_exception i32
66
.tagtype __c_longjmp i32
7-
.functype eh_legacy_test () -> ()
87
.functype foo () -> ()
98

109
eh_legacy_test:
10+
.functype eh_legacy_test () -> ()
11+
1112
# try-catch with catch, catch_all, throw, and rethrow
1213
try
1314
i32.const 3
@@ -55,7 +56,7 @@ eh_legacy_test:
5556
end_function
5657

5758
# CHECK-LABEL: eh_legacy_test:
58-
# CHECK-NEXT: try
59+
# CHECK: try
5960
# CHECK-NEXT: i32.const 3
6061
# CHECK-NEXT: throw __cpp_exception
6162
# CHECK-NEXT: catch __cpp_exception

llvm/test/MC/WebAssembly/func-end-errors.s

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
# assembly. This causes the parser to properly wrap up function info when there
55
# is no other instructions present.
66

7-
.functype test0 () -> ()
87
test0:
8+
.functype test0 () -> ()
99

10-
.functype test1 () -> ()
11-
# CHECK: [[@LINE+1]]:1: error: Unmatched block construct(s) at function end: function
1210
test1:
11+
# CHECK: [[@LINE+1]]:{{.*}}: error: Unmatched block construct(s) at function end: function
12+
.functype test1 () -> ()
1313
end_function
1414

15-
.functype test2 () -> ()
1615
test2:
17-
# CHECK: [[@LINE+1]]:1: error: Unmatched block construct(s) at function end: function
16+
.functype test2 () -> ()
17+
# CHECK: [[@LINE+1]]:{{.*}}: error: Unmatched block construct(s) at function end: function

llvm/test/MC/WebAssembly/funcref-from-table.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
.globl obtain_funcref_from_table_index
77

88
obtain_funcref_from_table_index:
9-
.functype obtain_funcref_from_table_index(i32) -> (funcref)
9+
.functype obtain_funcref_from_table_index (i32) -> (funcref)
1010
local.get 0
1111
table.get __indirect_function_table
1212
end_function

llvm/test/MC/WebAssembly/type-checker-br.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ br_block:
1616
end_function
1717

1818
br_func:
19-
.functype br_block () -> ()
19+
.functype br_func () -> ()
2020
block i32
2121
br 1
2222
i32.const 1

0 commit comments

Comments
 (0)