1 ; RUN: opt -mtriple=i686-unknown-windows-msvc -objc-arc-contract -S -o - %s | FileCheck %s
4 declare i32 @__CxxFrameHandler3(...)
5 declare dllimport i8* @llvm.objc.retain(i8*)
6 declare dllimport i8* @llvm.objc.retainAutoreleasedReturnValue(i8*)
7 declare dllimport void @llvm.objc.release(i8*)
9 @x = external global i8*
11 define void @g(i8* %p) personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*) {
12 invoke void @f() to label %invoke.cont unwind label %ehcleanup
15 %call = tail call i8* @llvm.objc.retain(i8* %p) nounwind
16 %tmp = load i8*, i8** @x, align 4
17 store i8* %call, i8** @x, align 4
18 tail call void @llvm.objc.release(i8* %tmp) nounwind
22 %1 = cleanuppad within none []
23 %call1 = tail call i8* @llvm.objc.retain(i8* %p) nounwind [ "funclet"(token %1) ]
24 %tmp1 = load i8*, i8** @x, align 4
25 store i8* %call1, i8** @x, align 4
26 tail call void @llvm.objc.release(i8* %tmp1) nounwind [ "funclet"(token %1) ]
27 cleanupret from %1 unwind to caller
30 ; CHECK-LABEL: invoke.cont:
31 ; CHECK: tail call void @llvm.objc.storeStrong(i8** @x, i8* %p) #0{{$}}
34 ; CHECK-LABEL: ehcleanup:
35 ; CHECK: %1 = cleanuppad within none []
36 ; CHECK: tail call void @llvm.objc.storeStrong(i8** @x, i8* %p) #0 [ "funclet"(token %1) ]
37 ; CHECK: cleanupret from %1 unwind to caller