Skip to content

Commit 6420f37

Browse files
authored
[WebAssembly] Implement an alternative translation for -wasm-enable-sjlj (#84137)
Instead of maintaining per-function-invocation malloc()'ed tables to track which functions each label belongs to, store the equivalent info in jump buffers (jmp_buf) themselves. Also, use a less emscripten-looking ABI symbols: ``` saveSetjmp -> __wasm_setjmp testSetjmp -> __wasm_setjmp_test getTempRet0 -> (removed) __wasm_longjmp -> (no change) ``` While I want to use this for WASI, it should work for emscripten as well. An example runtime and a few tests: https://github.com/yamt/garbage/tree/wasm-sjlj-alt2/wasm/longjmp wasi-libc version of the runtime: WebAssembly/wasi-libc#483 emscripten version of the runtime: emscripten-core/emscripten#21502 Discussion: https://docs.google.com/document/d/1ZvTPT36K5jjiedF8MCXbEmYjULJjI723aOAks1IdLLg/edit
1 parent 8bd1f91 commit 6420f37

File tree

8 files changed

+127
-298
lines changed

8 files changed

+127
-298
lines changed

llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp

Lines changed: 99 additions & 215 deletions
Large diffs are not rendered by default.

llvm/test/CodeGen/WebAssembly/lower-em-ehsjlj-options.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,12 @@ entry:
5959
%call = call i32 @setjmp(ptr %buf) #0
6060
call void @longjmp(ptr %buf, i32 1) #1
6161
unreachable
62-
; SJLJ: call saveSetjmp
62+
; SJLJ: call __wasm_setjmp
6363
; SJLJ: i32.const emscripten_longjmp
6464
; SJLJ-NOT: i32.const emscripten_longjmp_jmpbuf
6565
; SJLJ: call invoke_vii
6666
; SJLJ-NOT: call "__invoke_void_ptr_i32"
67-
; SJLJ: call testSetjmp
67+
; SJLJ: call __wasm_setjmp_test
6868

6969
; NONE: call setjmp
7070
; NONE: call longjmp

llvm/test/CodeGen/WebAssembly/lower-em-ehsjlj.ll

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ try.cont: ; preds = %lpad, %entry
4949

5050
; longjmp checking part
5151
; CHECK: if.then1:
52-
; CHECK: call i32 @testSetjmp
52+
; CHECK: call i32 @__wasm_setjmp_test
5353
}
5454

5555
; @foo can either throw an exception or longjmp. Because this function doesn't
@@ -117,7 +117,6 @@ if.end: ; preds = %entry
117117

118118
; CHECK: rethrow.exn:
119119
; CHECK-NEXT: %exn = call ptr @__cxa_find_matching_catch_2()
120-
; CHECK-NEXT: call void @free(ptr %setjmpTable{{.*}})
121120
; CHECK-NEXT: call void @__resumeException(ptr %exn)
122121
; CHECK-NEXT: unreachable
123122

@@ -147,7 +146,6 @@ throw: ; preds = %if.end, %entry
147146
unreachable
148147

149148
; CHECK: throw:
150-
; CHECK-NEXT: call void @free(ptr %setjmpTable{{.*}})
151149
; CHECK-NEXT: call void @__cxa_throw(ptr null, ptr null, ptr null)
152150
; CHECK-NEXT: unreachable
153151
}
@@ -208,7 +206,6 @@ return: ; preds = %entry, %if.end
208206

209207
; CHECK: rethrow.exn:
210208
; CHECK-NEXT: %exn = call ptr @__cxa_find_matching_catch_2()
211-
; CHECK-NEXT: tail call void @free(ptr %setjmpTable{{.*}})
212209
; CHECK-NEXT: call void @__resumeException(ptr %exn)
213210
; CHECK-NEXT: unreachable
214211
}

llvm/test/CodeGen/WebAssembly/lower-em-sjlj-alias.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ target triple = "wasm32-unknown-emscripten"
1212
; CHECK-LABEL: @malloc_test
1313
define void @malloc_test() {
1414
entry:
15-
; CHECK: call ptr @malloc
15+
; CHECK: alloca i32
1616
%retval = alloca i32, align 4
1717
%jmp = alloca [1 x %struct.__jmp_buf_tag], align 16
1818
store i32 0, ptr %retval, align 4

llvm/test/CodeGen/WebAssembly/lower-em-sjlj-debuginfo.ll

Lines changed: 3 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,22 @@ entry:
1616
call void @foo(), !dbg !7
1717
ret void, !dbg !8
1818
; CHECK: entry:
19-
; CHECK-NEXT: call ptr @malloc(i32 40), !dbg ![[DL0:.*]]
19+
; CHECK-NEXT: %functionInvocationId = alloca i32, align 4, !dbg ![[DL0:.*]]
2020

2121
; CHECK: entry.split:
2222
; CHECK: alloca {{.*}}, !dbg ![[DL0]]
23-
; CHECK: call ptr @saveSetjmp{{.*}}, !dbg ![[DL1:.*]]
24-
; CHECK-NEXT: call i32 @getTempRet0{{.*}}, !dbg ![[DL1]]
23+
; CHECK: call void @__wasm_setjmp{{.*}}, !dbg ![[DL1:.*]]
2524
; CHECK-NEXT: br {{.*}}, !dbg ![[DL2:.*]]
2625

2726
; CHECK: entry.split.split:
2827
; CHECK: call {{.*}} void @__invoke_void{{.*}}, !dbg ![[DL2]]
2928

3029
; CHECK: entry.split.split.split:
31-
; CHECK-NEXT: call void @free{{.*}}, !dbg ![[DL3:.*]]
3230

3331
; CHECK: if.then1:
34-
; CHECK: call i32 @testSetjmp{{.*}}, !dbg ![[DL2]]
32+
; CHECK: call i32 @__wasm_setjmp_test{{.*}}, !dbg ![[DL2]]
3533

3634
; CHECK: if.end:
37-
; CHECK: call i32 @getTempRet0{{.*}}, !dbg ![[DL2]]
3835

3936
; CHECK: call.em.longjmp:
4037
; CHECK: call void @emscripten_longjmp{{.*}}, !dbg ![[DL2]]
@@ -43,26 +40,6 @@ entry:
4340
; CHECK: call void @setTempRet0{{.*}}, !dbg ![[DL2]]
4441
}
4542

46-
; No instruction has debug info but the current function (setjmp_debug_info2)
47-
; and the called function (malloc / free) have DISubprograms, so the newly
48-
; generated calls should have debug info attached. We don't have an instruction
49-
; to take debug info from, so we create dummy debug info.
50-
define void @setjmp_debug_info1() !dbg !9 {
51-
; CHECK-LABEL: @setjmp_debug_info1
52-
entry:
53-
%buf = alloca [1 x %struct.__jmp_buf_tag], align 16
54-
%arraydecay = getelementptr inbounds [1 x %struct.__jmp_buf_tag], ptr %buf, i32 0, i32 0
55-
%call = call i32 @setjmp(ptr %arraydecay) #0
56-
call void @foo()
57-
ret void
58-
; CHECK: call ptr @malloc(i32 40), !dbg ![[DL_DUMMY:.*]]
59-
; CHECK: call void @free{{.*}}, !dbg ![[DL_DUMMY]]
60-
}
61-
62-
; Note that these functions have DISubprograms.
63-
declare !dbg !10 ptr @malloc(i32)
64-
declare !dbg !11 void @free(ptr)
65-
6643
declare void @foo()
6744
; Function Attrs: returns_twice
6845
declare i32 @setjmp(ptr) #0
@@ -79,9 +56,3 @@ declare i32 @setjmp(ptr) #0
7956
!6 = !DILocation(line:4, scope: !3)
8057
!7 = !DILocation(line:5, scope: !3)
8158
!8 = !DILocation(line:6, scope: !3)
82-
!9 = distinct !DISubprogram(name: "setjmp_debug_info1", unit:!2, file: !1, line: 50)
83-
!10 = !DISubprogram(name: "malloc", file: !1, line: 10, isDefinition: false)
84-
!11 = !DISubprogram(name: "free", file: !1, line: 20, isDefinition: false)
85-
86-
; Dummy debug info generated
87-
; CHECK: ![[DL_DUMMY]] = !DILocation(line: 50, column: 1, scope: !9)

llvm/test/CodeGen/WebAssembly/lower-em-sjlj.ll

Lines changed: 12 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,12 @@ entry:
2222
call void @longjmp(ptr %buf, i32 1) #1
2323
unreachable
2424
; CHECK: entry:
25-
; CHECK-NEXT: %[[MALLOCCALL:.*]] = tail call ptr @malloc([[PTR]] 40)
26-
; CHECK-NEXT: store i32 0, ptr %[[MALLOCCALL]]
27-
; CHECK-NEXT: %[[SETJMP_TABLE_SIZE:.*]] = add i32 4, 0
25+
; CHECK-NEXT: %functionInvocationId = alloca i32, align 4
2826
; CHECK-NEXT: br label %entry.split
2927

3028
; CHECK: entry.split
3129
; CHECK-NEXT: %[[BUF:.*]] = alloca [1 x %struct.__jmp_buf_tag]
32-
; CHECK-NEXT: %[[SETJMP_TABLE1:.*]] = call ptr @saveSetjmp(ptr %[[BUF]], i32 1, ptr %[[MALLOCCALL]], i32 %[[SETJMP_TABLE_SIZE]])
33-
; CHECK-NEXT: %[[SETJMP_TABLE_SIZE1:.*]] = call i32 @getTempRet0()
30+
; CHECK-NEXT: call void @__wasm_setjmp(ptr %[[BUF]], i32 1, ptr %functionInvocationId)
3431
; CHECK-NEXT: br label %entry.split.split
3532

3633
; CHECK: entry.split.split:
@@ -51,8 +48,7 @@ entry:
5148

5249
; CHECK: if.then1:
5350
; CHECK-NEXT: %[[__THREW__VAL_P:.*]] = inttoptr [[PTR]] %[[__THREW__VAL]] to ptr
54-
; CHECK-NEXT: %[[__THREW__VAL_P_LOADED:.*]] = load [[PTR]], ptr %[[__THREW__VAL_P]]
55-
; CHECK-NEXT: %[[LABEL:.*]] = call i32 @testSetjmp([[PTR]] %[[__THREW__VAL_P_LOADED]], ptr %[[SETJMP_TABLE1]], i32 %[[SETJMP_TABLE_SIZE1]])
51+
; CHECK-NEXT: %[[LABEL:.*]] = call i32 @__wasm_setjmp_test(ptr %[[__THREW__VAL_P]], ptr %functionInvocationId)
5652
; CHECK-NEXT: %[[CMP:.*]] = icmp eq i32 %[[LABEL]], 0
5753
; CHECK-NEXT: br i1 %[[CMP]], label %call.em.longjmp, label %if.end2
5854

@@ -69,7 +65,6 @@ entry:
6965
; CHECK: call.em.longjmp:
7066
; CHECK-NEXT: %threw.phi = phi [[PTR]] [ %[[__THREW__VAL]], %if.then1 ]
7167
; CHECK-NEXT: %threwvalue.phi = phi i32 [ %[[THREWVALUE_VAL]], %if.then1 ]
72-
; CHECK-NEXT: tail call void @free(ptr %[[SETJMP_TABLE1]])
7368
; CHECK-NEXT: call void @emscripten_longjmp([[PTR]] %threw.phi, i32 %threwvalue.phi)
7469
; CHECK-NEXT: unreachable
7570

@@ -87,13 +82,12 @@ entry:
8782
call void @foo()
8883
ret void
8984
; CHECK: entry:
90-
; CHECK: %[[SETJMP_TABLE:.*]] = call ptr @saveSetjmp(
85+
; CHECK: call void @__wasm_setjmp(
9186

9287
; CHECK: entry.split.split:
9388
; CHECK: @__invoke_void(ptr @foo)
9489

9590
; CHECK: entry.split.split.split:
96-
; CHECK-NEXT: tail call void @free(ptr %[[SETJMP_TABLE]])
9791
; CHECK-NEXT: ret void
9892
}
9993

@@ -110,9 +104,8 @@ entry:
110104
call void @foo()
111105
ret void
112106
; CHECK: call.em.longjmp:
113-
; CHECK-NEXT: %threw.phi = phi [[PTR]] [ %__THREW__.val, %if.then1 ], [ %__THREW__.val4, %if.then15 ]
114-
; CHECK-NEXT: %threwvalue.phi = phi i32 [ %__threwValue.val, %if.then1 ], [ %__threwValue.val8, %if.then15 ]
115-
; CHECK-NEXT: tail call void @free(ptr %[[SETJMP_TABLE1]])
107+
; CHECK-NEXT: %threw.phi = phi [[PTR]] [ %__THREW__.val, %if.then1 ], [ %__THREW__.val2, %if.then13 ]
108+
; CHECK-NEXT: %threwvalue.phi = phi i32 [ %__threwValue.val, %if.then1 ], [ %__threwValue.val6, %if.then13 ]
116109
; CHECK-NEXT: call void @emscripten_longjmp([[PTR]] %threw.phi, i32 %threwvalue.phi)
117110
; CHECK-NEXT: unreachable
118111
}
@@ -145,7 +138,6 @@ entry:
145138
%cmp = icmp sgt i32 %n, 5
146139
br i1 %cmp, label %if.then, label %if.end
147140
; CHECK: entry:
148-
; CHECK: %[[SETJMP_TABLE_SIZE0:.*]] = add i32 4, 0
149141

150142
if.then: ; preds = %entry
151143
%0 = load i32, ptr @global_var, align 4
@@ -154,22 +146,17 @@ if.then: ; preds = %entry
154146
br label %if.end
155147
; CHECK: if.then:
156148
; CHECK: %[[VAR0:.*]] = load i32, ptr @global_var, align 4
157-
; CHECK: %[[SETJMP_TABLE1:.*]] = call ptr @saveSetjmp(
158-
; CHECK-NEXT: %[[SETJMP_TABLE_SIZE1:.*]] = call i32 @getTempRet0()
149+
; CHECK: call void @__wasm_setjmp(
159150

160151
; CHECK: if.then.split:
161-
; CHECK: %[[VAR1:.*]] = phi i32 [ %[[VAR2:.*]], %if.end3 ], [ %[[VAR0]], %if.then ]
162-
; CHECK: %[[SETJMP_TABLE_SIZE2:.*]] = phi i32 [ %[[SETJMP_TABLE_SIZE1]], %if.then ], [ %[[SETJMP_TABLE_SIZE3:.*]], %if.end3 ]
163-
; CHECK: %[[SETJMP_TABLE2:.*]] = phi ptr [ %[[SETJMP_TABLE1]], %if.then ], [ %[[SETJMP_TABLE3:.*]], %if.end3 ]
152+
; CHECK: %[[VAR1:.*]] = phi i32 [ %[[VAR2:.*]], %if.end1 ], [ %[[VAR0]], %if.then ]
164153
; CHECK: store i32 %[[VAR1]], ptr @global_var, align 4
165154

166155
if.end: ; preds = %if.then, %entry
167156
call void @longjmp(ptr %buf, i32 5) #1
168157
unreachable
169158
; CHECK: if.end:
170159
; CHECK: %[[VAR2]] = phi i32 [ %[[VAR1]], %if.then.split ], [ undef, %entry.split ]
171-
; CHECK: %[[SETJMP_TABLE_SIZE3]] = phi i32 [ %[[SETJMP_TABLE_SIZE2]], %if.then.split ], [ %[[SETJMP_TABLE_SIZE0]], %entry.split ]
172-
; CHECK: %[[SETJMP_TABLE3]] = phi ptr [ %[[SETJMP_TABLE2]], %if.then.split ], [ %setjmpTable, %entry.split ]
173160
}
174161

175162
; Test a case when a function only calls other functions that are neither setjmp nor longjmp
@@ -296,8 +283,8 @@ declare void @free(ptr)
296283
; JS glue functions and invoke wrappers declaration
297284
; CHECK-DAG: declare i32 @getTempRet0()
298285
; CHECK-DAG: declare void @setTempRet0(i32)
299-
; CHECK-DAG: declare ptr @saveSetjmp(ptr, i32, ptr, i32)
300-
; CHECK-DAG: declare i32 @testSetjmp([[PTR]], ptr, i32)
286+
; CHECK-DAG: declare void @__wasm_setjmp(ptr, i32, ptr)
287+
; CHECK-DAG: declare i32 @__wasm_setjmp_test(ptr, ptr)
301288
; CHECK-DAG: declare void @emscripten_longjmp([[PTR]], i32)
302289
; CHECK-DAG: declare void @__invoke_void(ptr)
303290

@@ -308,8 +295,8 @@ attributes #3 = { allocsize(0) }
308295
; CHECK-DAG: attributes #{{[0-9]+}} = { nounwind "wasm-import-module"="env" "wasm-import-name"="getTempRet0" }
309296
; CHECK-DAG: attributes #{{[0-9]+}} = { nounwind "wasm-import-module"="env" "wasm-import-name"="setTempRet0" }
310297
; CHECK-DAG: attributes #{{[0-9]+}} = { "wasm-import-module"="env" "wasm-import-name"="__invoke_void" }
311-
; CHECK-DAG: attributes #{{[0-9]+}} = { "wasm-import-module"="env" "wasm-import-name"="saveSetjmp" }
312-
; CHECK-DAG: attributes #{{[0-9]+}} = { "wasm-import-module"="env" "wasm-import-name"="testSetjmp" }
298+
; CHECK-DAG: attributes #{{[0-9]+}} = { "wasm-import-module"="env" "wasm-import-name"="__wasm_setjmp" }
299+
; CHECK-DAG: attributes #{{[0-9]+}} = { "wasm-import-module"="env" "wasm-import-name"="__wasm_setjmp_test" }
313300
; CHECK-DAG: attributes #{{[0-9]+}} = { noreturn "wasm-import-module"="env" "wasm-import-name"="emscripten_longjmp" }
314301
; CHECK-DAG: attributes #{{[0-9]+}} = { "wasm-import-module"="env" "wasm-import-name"="__invoke_ptr_i32_ptr" }
315302
; CHECK-DAG: attributes #[[ALLOCSIZE_ATTR]] = { allocsize(1) }

llvm/test/CodeGen/WebAssembly/lower-wasm-ehsjlj.ll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ catch: ; preds = %catch.start
108108
call void @__cxa_end_catch() [ "funclet"(token %2) ]
109109
catchret from %2 to label %catchret.dest
110110
; CHECK: catch: ; preds = %catch.start
111-
; CHECK-NEXT: %exn = load ptr, ptr %exn.slot15, align 4
112-
; CHECK-NEXT: %5 = call ptr @__cxa_begin_catch(ptr %exn) #7 [ "funclet"(token %2) ]
111+
; CHECK-NEXT: %exn = load ptr, ptr %exn.slot6, align 4
112+
; CHECK-NEXT: %5 = call ptr @__cxa_begin_catch(ptr %exn) #6 [ "funclet"(token %2) ]
113113
; CHECK-NEXT: invoke void @__cxa_end_catch() [ "funclet"(token %2) ]
114114
; CHECK-NEXT: to label %.noexc unwind label %catch.dispatch.longjmp
115115

@@ -265,7 +265,7 @@ ehcleanup: ; preds = %entry
265265
; (cleanuppad), whose parent is 'none', so we should unwind directly to
266266
; %catch.dispatch.longjmp.
267267
%call2 = call noundef ptr @_ZN4TempD2Ev(ptr noundef %t) #2 [ "funclet"(token %0) ]
268-
; CHECK: %call13 = invoke {{.*}} ptr @_ZN4TempD2Ev(ptr
268+
; CHECK: %call11 = invoke {{.*}} ptr @_ZN4TempD2Ev(ptr
269269
; CHECK-NEXT: to label {{.*}} unwind label %catch.dispatch.longjmp
270270
cleanupret from %0 unwind to caller
271271
}

llvm/test/CodeGen/WebAssembly/lower-wasm-sjlj.ll

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,31 +25,24 @@ entry:
2525
unreachable
2626

2727
; CHECK: entry:
28-
; CHECK-NEXT: %setjmpTable = tail call ptr @malloc([[PTR]] 40)
29-
; CHECK-NEXT: store i32 0, ptr %setjmpTable, align 4
30-
; CHECK-NEXT: %setjmpTableSize = add i32 4, 0
28+
; CHECK-NEXT: %functionInvocationId = alloca i32, align 4
3129
; CHECK-NEXT: br label %setjmp.dispatch
3230

3331
; CHECK: setjmp.dispatch:
3432
; CHECK-NEXT: %[[VAL2:.*]] = phi i32 [ %val, %if.end ], [ undef, %entry ]
3533
; CHECK-NEXT: %[[BUF:.*]] = phi ptr [ %[[BUF2:.*]], %if.end ], [ undef, %entry ]
36-
; CHECK-NEXT: %[[SETJMPTABLESIZE2:.*]] = phi i32 [ %[[SETJMPTABLESIZE3:.*]], %if.end ], [ %setjmpTableSize, %entry ]
37-
; CHECK-NEXT: %[[SETJMPTABLE2:.*]] = phi ptr [ %[[SETJMPTABLE3:.*]], %if.end ], [ %setjmpTable, %entry ]
3834
; CHECK-NEXT: %label.phi = phi i32 [ %label, %if.end ], [ -1, %entry ]
3935
; CHECK-NEXT: switch i32 %label.phi, label %entry.split [
4036
; CHECK-NEXT: i32 1, label %entry.split.split
4137
; CHECK-NEXT: ]
4238

4339
; CHECK: entry.split:
4440
; CHECK-NEXT: %buf = alloca [1 x %struct.__jmp_buf_tag], align 16
45-
; CHECK-NEXT: %[[SETJMPTABLE4:.*]] = call ptr @saveSetjmp(ptr %buf, i32 1, ptr %[[SETJMPTABLE2]], i32 %[[SETJMPTABLESIZE2]])
46-
; CHECK-NEXT: %[[SETJMPTABLESIZE4:.*]] = call i32 @getTempRet0()
41+
; CHECK-NEXT: call void @__wasm_setjmp(ptr %buf, i32 1, ptr %functionInvocationId)
4742
; CHECK-NEXT: br label %entry.split.split
4843

4944
; CHECK: entry.split.split:
5045
; CHECK-NEXT: %[[BUF2]] = phi ptr [ %[[BUF]], %setjmp.dispatch ], [ %buf, %entry.split ]
51-
; CHECK-NEXT: %[[SETJMPTABLESIZE3]] = phi i32 [ %[[SETJMPTABLESIZE4]], %entry.split ], [ %[[SETJMPTABLESIZE2]], %setjmp.dispatch ]
52-
; CHECK-NEXT: %[[SETJMPTABLE3]] = phi ptr [ %[[SETJMPTABLE4]], %entry.split ], [ %[[SETJMPTABLE2]], %setjmp.dispatch ]
5346
; CHECK-NEXT: %setjmp.ret = phi i32 [ 0, %entry.split ], [ %[[VAL2]], %setjmp.dispatch ]
5447
; CHECK-NEXT: invoke void @__wasm_longjmp(ptr %[[BUF2]], i32 1)
5548
; CHECK-NEXT: to label %.noexc unwind label %catch.dispatch.longjmp
@@ -67,13 +60,11 @@ entry:
6760
; CHECK-NEXT: %val_gep = getelementptr { ptr, i32 }, ptr %thrown, i32 0, i32 1
6861
; CHECK-NEXT: %env = load ptr, ptr %env_gep, align {{.*}}
6962
; CHECK-NEXT: %val = load i32, ptr %val_gep, align 4
70-
; CHECK-NEXT: %setjmp.id = load [[PTR]], ptr %env, align {{.*}}
71-
; CHECK-NEXT: %label = call i32 @testSetjmp([[PTR]] %setjmp.id, ptr %[[SETJMPTABLE3]], i32 %[[SETJMPTABLESIZE3]]) [ "funclet"(token %1) ]
63+
; CHECK-NEXT: %label = call i32 @__wasm_setjmp_test(ptr %env, ptr %functionInvocationId) [ "funclet"(token %1) ]
7264
; CHECK-NEXT: %2 = icmp eq i32 %label, 0
7365
; CHECK-NEXT: br i1 %2, label %if.then, label %if.end
7466

7567
; CHECK: if.then:
76-
; CHECK-NEXT: tail call void @free(ptr %[[SETJMPTABLE3]]) [ "funclet"(token %1) ]
7768
; CHECK-NEXT: call void @__wasm_longjmp(ptr %env, i32 %val) [ "funclet"(token %1) ]
7869
; CHECK-NEXT: unreachable
7970

@@ -142,10 +133,9 @@ declare ptr @__cxa_begin_catch(ptr)
142133
declare void @__cxa_end_catch()
143134
declare void @free(ptr)
144135

145-
; JS glue function declarations
146-
; CHECK-DAG: declare i32 @getTempRet0()
147-
; CHECK-DAG: declare ptr @saveSetjmp(ptr, i32, ptr, i32)
148-
; CHECK-DAG: declare i32 @testSetjmp([[PTR]], ptr, i32)
136+
; Runtime glue function declarations
137+
; CHECK-DAG: declare void @__wasm_setjmp(ptr, i32, ptr)
138+
; CHECK-DAG: declare i32 @__wasm_setjmp_test(ptr, ptr)
149139
; CHECK-DAG: declare void @__wasm_longjmp(ptr, i32)
150140

151141
attributes #0 = { returns_twice }

0 commit comments

Comments
 (0)