1 ; RUN: opt -mtriple=i686-unknown-windows-msvc -passes=objc-arc-contract -S -o - %s | FileCheck %s
3 ; Generated (and lightly modified and cleaned up) from the following source:
13 ; CHECK-LABEL: define void @"\01?g@@YAXXZ"()
15 ; CHECK: call void asm sideeffect "movl{{.*}}%ebp, %ebp{{.*}}", ""() [ "funclet"(token %1) ]
17 ; CHECK-LABEL: catch.1
18 ; CHECK: call void asm sideeffect "movl{{.*}}%ebp, %ebp{{.*}}", ""() [ "funclet"(token %1) ]
20 ; CHECK-LABEL: invoke.cont
21 ; CHECK: call void asm sideeffect "movl{{.*}}%ebp, %ebp{{.*}}", ""(){{$}}
23 define void @"\01?g@@YAXXZ"() personality ptr @__CxxFrameHandler3 {
25 %call = invoke ptr @"\01?f@@YAPAUobjc_object@@XZ"()
26 to label %invoke.cont unwind label %catch.dispatch
28 catch.dispatch: ; preds = %entry
29 %0 = catchswitch within none [label %catch] unwind to caller
31 catch: ; preds = %catch.dispatch
32 %1 = catchpad within %0 [ptr null, i32 64, ptr null]
33 %call1 = call ptr @"\01?f@@YAPAUobjc_object@@XZ"() [ "funclet"(token %1) ]
34 %2 = call ptr @llvm.objc.retainAutoreleasedReturnValue(ptr %call1) [ "funclet"(token %1) ]
35 call void @llvm.objc.release(ptr %2) [ "funclet"(token %1) ]
38 catch.1: ; preds = %catch
39 %call2 = call ptr @"\01?f@@YAPAUobjc_object@@XZ"() [ "funclet"(token %1) ]
40 %3 = call ptr @llvm.objc.retainAutoreleasedReturnValue(ptr %call2) [ "funclet"(token %1) ]
41 call void @llvm.objc.release(ptr %3) [ "funclet"(token %1) ]
42 catchret from %1 to label %catchret.dest
44 catchret.dest: ; preds = %catch.1
47 invoke.cont: ; preds = %entry
48 %4 = call ptr @llvm.objc.retainAutoreleasedReturnValue(ptr %call)
49 call void @llvm.objc.release(ptr %4)
53 ; CHECK-LABEL: define dso_local void @"?test_attr_claimRV@@YAXXZ"()
54 ; CHECK: %[[CALL4:.*]] = notail call ptr @"?noexcept_func@@YAPAUobjc_object@@XZ"() [ "clang.arc.attachedcall"(ptr @llvm.objc.unsafeClaimAutoreleasedReturnValue) ]
55 ; CHECK-NEXT: ret void
57 ; CHECK: %[[V1:.*]] = cleanuppad
58 ; CHECK: %[[CALL:.*]] = notail call ptr @"?noexcept_func@@YAPAUobjc_object@@XZ"() [ "funclet"(token %[[V1]]), "clang.arc.attachedcall"(ptr @llvm.objc.unsafeClaimAutoreleasedReturnValue) ]
59 ; CHECK-NEXT: cleanupret from %[[V1]] unwind to caller
61 define dso_local void @"?test_attr_claimRV@@YAXXZ"() local_unnamed_addr #0 personality ptr @__CxxFrameHandler3 {
63 invoke void @"?foo@@YAXXZ"()
64 to label %invoke.cont unwind label %ehcleanup
66 invoke.cont: ; preds = %entry
67 %call.i4 = tail call ptr @"?noexcept_func@@YAPAUobjc_object@@XZ"() #2 [ "clang.arc.attachedcall"(ptr @llvm.objc.unsafeClaimAutoreleasedReturnValue) ]
70 ehcleanup: ; preds = %entry
71 %0 = cleanuppad within none []
72 %call.i = call ptr @"?noexcept_func@@YAPAUobjc_object@@XZ"() #2 [ "funclet"(token %0), "clang.arc.attachedcall"(ptr @llvm.objc.unsafeClaimAutoreleasedReturnValue) ]
73 cleanupret from %0 unwind to caller
76 declare ptr @"\01?f@@YAPAUobjc_object@@XZ"()
78 declare i32 @__CxxFrameHandler3(...)
80 declare void @"?foo@@YAXXZ"()
81 declare ptr @"?noexcept_func@@YAPAUobjc_object@@XZ"()
83 declare dllimport ptr @llvm.objc.retainAutoreleasedReturnValue(ptr)
84 declare ptr @llvm.objc.unsafeClaimAutoreleasedReturnValue(ptr)
86 declare dllimport void @llvm.objc.release(ptr)
88 !llvm.module.flags = !{!0}
90 !0 = !{i32 1, !"clang.arc.retainAutoreleasedReturnValueMarker", !"movl\09%ebp, %ebp\09\09// marker for objc_retainAutoreleaseReturnValue"}