1 ; RUN: opt < %s -wasm-lower-em-ehsjlj -enable-emscripten-cxx-exceptions -emscripten-cxx-exceptions-allowed=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 ptr @__gxx_personality_v0 {
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 { ptr, i32 }
21 %1 = extractvalue { ptr, i32 } %0, 0
22 %2 = extractvalue { ptr, i32 } %0, 1
25 catch: ; preds = %lpad
26 %3 = call ptr @__cxa_begin_catch(ptr %1)
27 call void @__cxa_end_catch()
30 try.cont: ; preds = %catch, %invoke.cont
34 define void @do_catch() personality ptr @__gxx_personality_v0 {
35 ; CHECK-LABEL: @do_catch(
38 to label %invoke.cont unwind label %lpad
40 ; CHECK-NEXT: store i32 0, ptr
41 ; CHECK-NEXT: call cc{{.*}} void @__invoke_void(ptr @foo)
43 invoke.cont: ; preds = %entry
46 lpad: ; preds = %entry
47 %0 = landingpad { ptr, i32 }
49 %1 = extractvalue { ptr, i32 } %0, 0
50 %2 = extractvalue { ptr, i32 } %0, 1
53 catch: ; preds = %lpad
54 %3 = call ptr @__cxa_begin_catch(ptr %1)
55 call void @__cxa_end_catch()
58 try.cont: ; preds = %catch, %invoke.cont
63 declare i32 @__gxx_personality_v0(...)
64 declare ptr @__cxa_begin_catch(ptr)
65 declare void @__cxa_end_catch()