1; RUN: opt -mtriple=i686-unknown-windows-msvc -objc-arc-contract -S -o - %s | FileCheck %s
2
3; Generated (and lightly modified and cleaned up) from the following source:
4; id f();
5; void g() {
6;   try {
7;     f();
8;   } catch (...) {
9;     f();
10;   }
11; }
12
13define void @"\01?g@@YAXXZ"() personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*) {
14entry:
15  %call = invoke i8* @"\01?f@@YAPAUobjc_object@@XZ"()
16          to label %invoke.cont unwind label %catch.dispatch
17
18catch.dispatch:                                   ; preds = %entry
19  %0 = catchswitch within none [label %catch] unwind to caller
20
21catch:                                            ; preds = %catch.dispatch
22  %1 = catchpad within %0 [i8* null, i32 64, i8* null]
23  %call1 = call i8* @"\01?f@@YAPAUobjc_object@@XZ"() [ "funclet"(token %1) ]
24  %2 = call i8* @llvm.objc.retainAutoreleasedReturnValue(i8* %call1) [ "funclet"(token %1) ]
25  call void @llvm.objc.release(i8* %2) [ "funclet"(token %1) ]
26  br label %catch.1
27
28catch.1:                                          ; preds = %catch
29  %call2 = call i8* @"\01?f@@YAPAUobjc_object@@XZ"() [ "funclet"(token %1) ]
30  %3 = call i8* @llvm.objc.retainAutoreleasedReturnValue(i8* %call2) [ "funclet"(token %1) ]
31  call void @llvm.objc.release(i8* %3) [ "funclet"(token %1) ]
32  catchret from %1 to label %catchret.dest
33
34catchret.dest:                                    ; preds = %catch.1
35  ret void
36
37invoke.cont:                                      ; preds = %entry
38  %4 = call i8* @llvm.objc.retainAutoreleasedReturnValue(i8* %call)
39  call void @llvm.objc.release(i8* %4)
40  ret void
41}
42
43declare i8* @"\01?f@@YAPAUobjc_object@@XZ"()
44
45declare i32 @__CxxFrameHandler3(...)
46
47declare dllimport i8* @llvm.objc.retainAutoreleasedReturnValue(i8*)
48
49declare dllimport void @llvm.objc.release(i8*)
50
51!llvm.module.flags = !{!0}
52
53!0 = !{i32 1, !"clang.arc.retainAutoreleasedReturnValueMarker", !"movl\09%ebp, %ebp\09\09// marker for objc_retainAutoreleaseReturnValue"}
54
55; CHECK-LABEL: catch
56; CHECK: call void asm sideeffect "movl{{.*}}%ebp, %ebp{{.*}}", ""() [ "funclet"(token %1) ]
57
58; CHECK-LABEL: catch.1
59; CHECK: call void asm sideeffect "movl{{.*}}%ebp, %ebp{{.*}}", ""() [ "funclet"(token %1) ]
60
61; CHECK-LABEL: invoke.cont
62; CHECK: call void asm sideeffect "movl{{.*}}%ebp, %ebp{{.*}}", ""(){{$}}
63