1 ; RUN: opt -mtriple=x86_64-windows-msvc -passes=objc-arc -S < %s | FileCheck %s
3 ; Check that funclet tokens are preserved
6 ; CHECK: %1 = catchpad within %0
7 ; CHECK: %2 = tail call ptr @llvm.objc.retain(ptr %exn) #0 [ "funclet"(token %1) ]
8 ; CHECK: call void @llvm.objc.release(ptr %exn) #0 [ "funclet"(token %1) ]
9 ; CHECK: catchret from %1 to label %eh.cont
11 define void @try_catch_with_objc_intrinsic() personality ptr @__CxxFrameHandler3 {
13 %exn.slot = alloca ptr, align 8
14 invoke void @may_throw(ptr null) to label %eh.cont unwind label %catch.dispatch
16 catch.dispatch: ; preds = %entry
17 %0 = catchswitch within none [label %catch] unwind to caller
19 eh.cont: ; preds = %catch, %entry
22 catch: ; preds = %catch.dispatch
23 %1 = catchpad within %0 [ptr null, i32 0, ptr %exn.slot]
26 if.then: ; preds = %catch
27 %exn = load ptr, ptr null, align 8
28 %2 = call ptr @llvm.objc.retain(ptr %exn) [ "funclet"(token %1) ]
29 call void @may_throw(ptr %exn)
30 call void @llvm.objc.release(ptr %exn) [ "funclet"(token %1) ]
31 catchret from %1 to label %eh.cont
34 declare void @may_throw(ptr)
35 declare i32 @__CxxFrameHandler3(...)
37 declare ptr @llvm.objc.retain(ptr) #0
38 declare void @llvm.objc.release(ptr) #0
40 attributes #0 = { nounwind }