1 ; RUN: opt -S -passes=objc-arc-contract < %s | FileCheck %s
3 target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"
4 target triple = "i686--windows-msvc19.11.0"
8 declare i32 @__CxxFrameHandler3(...)
9 declare dllimport void @llvm.objc.release(ptr) local_unnamed_addr
10 declare dllimport ptr @llvm.objc.retain(ptr returned) local_unnamed_addr
12 @p = global ptr null, align 4
14 declare void @f() local_unnamed_addr
16 define void @g() local_unnamed_addr personality ptr @__CxxFrameHandler3 {
18 %tmp = load ptr, ptr @p, align 4
19 %tmp1 = tail call ptr @llvm.objc.retain(ptr %tmp) #0
20 ; Split the basic block to ensure bitcast ends up in entry.split.
25 to label %invoke.cont unwind label %catch.dispatch
27 ; Dummy nested catchswitch to test looping through the dominator tree.
29 %tmp2 = catchswitch within none [label %catch] unwind label %catch.dispatch1
32 %tmp3 = catchpad within %tmp2 [ptr null, i32 64, ptr null]
33 catchret from %tmp3 to label %invoke.cont
36 %tmp4 = catchswitch within none [label %catch1] unwind label %ehcleanup
39 %tmp5 = catchpad within %tmp4 [ptr null, i32 64, ptr null]
40 catchret from %tmp5 to label %invoke.cont
43 %tmp6 = load ptr, ptr @p, align 4
44 %tmp7 = tail call ptr @llvm.objc.retain(ptr %tmp6) #0
45 call void @llvm.objc.release(ptr %tmp) #0, !clang.imprecise_release !0
46 ; Split the basic block to ensure bitcast ends up in invoke.cont.split.
47 br label %invoke.cont.split
51 to label %invoke.cont1 unwind label %ehcleanup
57 %tmp8 = phi ptr [ %tmp, %catch.dispatch1 ], [ %tmp6, %invoke.cont.split ]
58 %tmp9 = cleanuppad within none []
59 call void @llvm.objc.release(ptr %tmp8) #0 [ "funclet"(token %tmp9) ]
60 cleanupret from %tmp9 unwind to caller
63 ; CHECK-LABEL: entry.split:
64 ; CHECK-NEXT: invoke void @f()
65 ; CHECK-NEXT: to label %invoke.cont unwind label %catch.dispatch
67 ; CHECK-LABEL: invoke.cont.split:
68 ; CHECK-NEXT: invoke void @f()
69 ; CHECK-NEXT: to label %invoke.cont1 unwind label %ehcleanup
71 ; CHECK-LABEL: ehcleanup:
72 ; CHECK-NEXT: %tmp8 = phi ptr [ %tmp1, %catch.dispatch1 ], [ %tmp7, %invoke.cont.split ]
74 attributes #0 = { nounwind }