1 ; RUN: opt -mtriple x86_64-unknown-windows-msvc -passes=objc-arc -o - %s | llvm-dis -o - - | FileCheck %s
3 target triple = "x86_64-unknown-windows-msvc"
5 declare i32 @__CxxFrameHandler3(...)
7 declare dllimport ptr @objc_msgSend(ptr, ptr, ...) local_unnamed_addr
9 declare dllimport ptr @llvm.objc.retain(ptr returned) local_unnamed_addr
10 declare dllimport void @llvm.objc.release(ptr) local_unnamed_addr
11 declare dllimport ptr @llvm.objc.retainAutoreleasedReturnValue(ptr returned) local_unnamed_addr
13 declare dllimport ptr @llvm.objc.begin_catch(ptr) local_unnamed_addr
14 declare dllimport void @llvm.objc.end_catch() local_unnamed_addr
16 @llvm.objc.METH_VAR_NAME_ = private unnamed_addr constant [2 x i8] c"m\00", align 1
17 @llvm.objc.SELECTOR_REFERENCES_ = private externally_initialized global ptr @llvm.objc.METH_VAR_NAME_, section ".objc_selrefs$B", align 8
19 define void @f(ptr %i) local_unnamed_addr personality ptr @__CxxFrameHandler3 {
21 %0 = tail call ptr @llvm.objc.retain(ptr %i)
22 %1 = load ptr, ptr @llvm.objc.SELECTOR_REFERENCES_, align 8, !invariant.load !0
23 %call = invoke ptr @objc_msgSend(ptr %0, ptr %1)
24 to label %invoke.cont unwind label %catch.dispatch, !clang.arc.no_objc_arc_exceptions !0
26 catch.dispatch: ; preds = %entry
27 %2 = catchswitch within none [label %catch] unwind to caller
29 invoke.cont: ; preds = %entry
30 %3 = tail call ptr @llvm.objc.retainAutoreleasedReturnValue(ptr %call)
31 tail call void @llvm.objc.release(ptr %3) #0, !clang.imprecise_release !0
34 eh.cont: ; preds = %invoke.cont, %catch
35 tail call void @llvm.objc.release(ptr %0) #0, !clang.imprecise_release !0
38 catch: ; preds = %catch.dispatch
39 %4 = catchpad within %2 [ptr null, i32 0, ptr null]
40 %exn.adjusted = tail call ptr @llvm.objc.begin_catch(ptr undef)
41 tail call void @llvm.objc.end_catch(), !clang.arc.no_objc_arc_exceptions !0
42 catchret from %4 to label %eh.cont
47 ; CHECK-NOT: tail call ptr @llvm.objc.retain(ptr %i)
48 ; CHECK: load ptr, ptr @llvm.objc.SELECTOR_REFERENCES_, align 8
51 ; CHECK-NOT: call void @llvm.objc.release(ptr
54 attributes #0 = { nounwind }