1 ; RUN: opt -S -objc-arc < %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-msvc"
6 declare i8* @f(i8*, i8*)
8 declare i32 @__CxxFrameHandler3(...)
10 declare dllimport i8* @llvm.objc.autoreleaseReturnValue(i8* returned)
11 declare dllimport i8* @llvm.objc.retain(i8* returned)
12 declare dllimport i8* @llvm.objc.retainAutoreleasedReturnValue(i8* returned)
13 declare dllimport void @llvm.objc.release(i8*)
15 define i8* @g(i8* %p, i8* %q) local_unnamed_addr personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*) {
17 %0 = tail call i8* @llvm.objc.retain(i8* %p) #0
18 %1 = tail call i8* @llvm.objc.retain(i8* %q) #0
19 %call = invoke i8* @f(i8* %p, i8* %q)
20 to label %invoke.cont unwind label %catch.dispatch, !clang.arc.no_objc_arc_exceptions !0
23 %2 = catchswitch within none [label %catch] unwind to caller
26 %3 = catchpad within %2 [i8* null, i32 64, i8* null]
27 catchret from %3 to label %cleanup
30 %4 = tail call i8* @llvm.objc.retainAutoreleasedReturnValue(i8* %call) #0
34 %retval.0 = phi i8* [ %call, %invoke.cont ], [ null, %catch ]
35 tail call void @llvm.objc.release(i8* %q) #0, !clang.imprecise_release !0
36 tail call void @llvm.objc.release(i8* %p) #0, !clang.imprecise_release !0
37 %5 = tail call i8* @llvm.objc.autoreleaseReturnValue(i8* %retval.0) #0
42 ; CHECK-NEXT: %0 = tail call i8* @llvm.objc.retain(i8* %p) #0
43 ; CHECK-NEXT: %call = invoke i8* @f(i8* %p, i8* %q)
44 ; CHECK-NEXT: to label %invoke.cont unwind label %catch.dispatch
46 ; CHECK-LABEL: catch.dispatch:
47 ; CHECK-NEXT: %1 = catchswitch within none [label %catch] unwind to caller
49 ; CHECK-LABEL: cleanup:
50 ; CHECK: tail call void @llvm.objc.release(i8* %p) #0
52 attributes #0 = { nounwind }