brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.6 KiB · f0d622a Raw
69 lines · plain
1; RUN: not --crash opt < %s -wasm-lower-em-ehsjlj -wasm-enable-eh -wasm-enable-sjlj -S 2>&1 | FileCheck %s2 3target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"4target triple = "wasm32-unknown-unknown"5 6%struct.__jmp_buf_tag = type { [6 x i32], i32, [32 x i32] }7@_ZTIi = external constant ptr8 9define void @setjmp_within_catch() personality ptr @__gxx_wasm_personality_v0 {10entry:11  %buf = alloca [1 x %struct.__jmp_buf_tag], align 1612  invoke void @foo()13          to label %try.cont unwind label %catch.dispatch14 15catch.dispatch:                                   ; preds = %entry16  %0 = catchswitch within none [label %catch.start] unwind to caller17 18catch.start:                                      ; preds = %catch.dispatch19  %1 = catchpad within %0 [ptr @_ZTIi]20  %2 = call ptr @llvm.wasm.get.exception(token %1)21  %3 = call i32 @llvm.wasm.get.ehselector(token %1)22  %4 = call i32 @llvm.eh.typeid.for(ptr @_ZTIi) #023  %matches = icmp eq i32 %3, %424  br i1 %matches, label %catch, label %rethrow25 26catch:                                            ; preds = %catch.start27  %5 = call ptr @__cxa_begin_catch(ptr %2) #0 [ "funclet"(token %1) ]28  %6 = load i32, ptr %5, align 429; CHECK: LLVM ERROR: In function setjmp_within_catch: setjmp within a catch clause is not supported in Wasm EH30; CHECK-NEXT: %call = invoke i32 @setjmp31  %call = invoke i32 @setjmp(ptr noundef %buf) #2 [ "funclet"(token %1) ]32          to label %invoke.cont1 unwind label %ehcleanup33 34invoke.cont1:                                     ; preds = %catch35  call void @__cxa_end_catch() #0 [ "funclet"(token %1) ]36  catchret from %1 to label %try.cont37 38rethrow:                                          ; preds = %catch.start39  call void @llvm.wasm.rethrow() #1 [ "funclet"(token %1) ]40  unreachable41 42try.cont:                                         ; preds = %entry, %invoke.cont143  ret void44 45ehcleanup:                                        ; preds = %catch46  %7 = cleanuppad within %1 []47  call void @__cxa_end_catch() #0 [ "funclet"(token %7) ]48  cleanupret from %7 unwind to caller49}50 51declare void @foo()52declare i32 @__gxx_wasm_personality_v0(...)53; Function Attrs: nounwind54declare ptr @llvm.wasm.get.exception(token) #055; Function Attrs: nounwind56declare i32 @llvm.wasm.get.ehselector(token) #057; Function Attrs: nounwind58declare i32 @llvm.eh.typeid.for(ptr) #059; Function Attrs: noreturn60declare void @llvm.wasm.rethrow() #161declare ptr @__cxa_begin_catch(ptr)62; Function Attrs: returns_twice63declare i32 @setjmp(ptr noundef) #264declare void @__cxa_end_catch()65 66attributes #0 = { nounwind }67attributes #1 = { noreturn }68attributes #2 = { returns_twice }69