1 ; RUN: opt < %s -wasm-lower-em-ehsjlj -emscripten-cxx-exceptions-whitelist=do_catch -S | FileCheck %s
3 target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
4 target triple = "wasm32-unknown-unknown"
6 define void @dont_catch() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
7 ; CHECK-LABEL: @dont_catch(
10 to label %invoke.cont unwind label %lpad
12 ; CHECK-NEXT: call void @foo()
13 ; CHECK-NEXT: br label %invoke.cont
15 invoke.cont: ; preds = %entry
18 lpad: ; preds = %entry
19 %0 = landingpad { i8*, i32 }
21 %1 = extractvalue { i8*, i32 } %0, 0
22 %2 = extractvalue { i8*, i32 } %0, 1
25 catch: ; preds = %lpad
26 %3 = call i8* @__cxa_begin_catch(i8* %1)
27 call void @__cxa_end_catch()
30 try.cont: ; preds = %catch, %invoke.cont
34 define void @do_catch() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
35 ; CHECK-LABEL: @do_catch(
38 to label %invoke.cont unwind label %lpad
40 ; CHECK-NEXT: store i32 0, i32*
41 ; CHECK-NEXT: call cc{{.*}} void @__invoke_void(void ()* @foo)
43 invoke.cont: ; preds = %entry
46 lpad: ; preds = %entry
47 %0 = landingpad { i8*, i32 }
49 %1 = extractvalue { i8*, i32 } %0, 0
50 %2 = extractvalue { i8*, i32 } %0, 1
53 catch: ; preds = %lpad
54 %3 = call i8* @__cxa_begin_catch(i8* %1)
55 call void @__cxa_end_catch()
58 try.cont: ; preds = %catch, %invoke.cont
63 declare i32 @__gxx_personality_v0(...)
64 declare i8* @__cxa_begin_catch(i8*)
65 declare void @__cxa_end_catch()