1; RUN: llc < %s -enable-emscripten-cxx-exceptions | FileCheck %s --check-prefix=EH 2; RUN: llc < %s -enable-emscripten-sjlj | FileCheck %s --check-prefix=SJLJ 3; RUN: llc < %s | FileCheck %s --check-prefix=NONE 4 5target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128" 6target triple = "wasm32-unknown-unknown" 7 8%struct.__jmp_buf_tag = type { [6 x i32], i32, [32 x i32] } 9 10define hidden void @exception() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { 11; EH-LABEL: type exception,@function 12; NONE-LABEL: type exception,@function 13entry: 14 invoke void @foo() 15 to label %try.cont unwind label %lpad 16; EH: call __invoke_void 17; NONE: call foo 18 19lpad: ; preds = %entry 20 %0 = landingpad { i8*, i32 } 21 catch i8* null 22 %1 = extractvalue { i8*, i32 } %0, 0 23 %2 = extractvalue { i8*, i32 } %0, 1 24 %3 = call i8* @__cxa_begin_catch(i8* %1) #2 25 call void @__cxa_end_catch() 26 br label %try.cont 27 28try.cont: ; preds = %entry, %lpad 29 ret void 30} 31 32define hidden void @setjmp_longjmp() { 33; SJLJ-LABEL: type setjmp_longjmp,@function 34; NONE-LABEL: type setjmp_longjmp,@function 35entry: 36 %buf = alloca [1 x %struct.__jmp_buf_tag], align 16 37 %arraydecay = getelementptr inbounds [1 x %struct.__jmp_buf_tag], [1 x %struct.__jmp_buf_tag]* %buf, i32 0, i32 0 38 %call = call i32 @setjmp(%struct.__jmp_buf_tag* %arraydecay) #0 39 %arraydecay1 = getelementptr inbounds [1 x %struct.__jmp_buf_tag], [1 x %struct.__jmp_buf_tag]* %buf, i32 0, i32 0 40 call void @longjmp(%struct.__jmp_buf_tag* %arraydecay1, i32 1) #1 41 unreachable 42; SJLJ: call saveSetjmp 43; SJLJ: call testSetjmp 44; NONE: call setjmp 45; NONE: call longjmp 46} 47 48declare void @foo() 49declare i32 @__gxx_personality_v0(...) 50declare i8* @__cxa_begin_catch(i8*) 51declare void @__cxa_end_catch() 52; Function Attrs: returns_twice 53declare i32 @setjmp(%struct.__jmp_buf_tag*) #0 54; Function Attrs: noreturn 55declare void @longjmp(%struct.__jmp_buf_tag*, i32) #1 56declare i8* @malloc(i32) 57declare void @free(i8*) 58 59attributes #0 = { returns_twice } 60attributes #1 = { noreturn } 61attributes #2 = { nounwind } 62