1 // RUN: %clang_cc1 -emit-llvm -triple i686-apple-darwin9 -fobjc-runtime=macosx-fragile-10.5 -o - %s -O2 | FileCheck %s
9 @implementation MyClass
11 // CHECK: define internal void @"\01-[MyClass method]"
14 // CHECK: call void @objc_sync_enter
15 // CHECK: call void @objc_exception_try_enter
16 // CHECK: call i32 @_setjmp
23 // CHECK: define void @foo(
25 // CHECK: [[A:%.*]] = alloca i8*
26 // CHECK: [[SYNC:%.*]] = alloca i8*
28 // CHECK: store i8* [[AVAL:%.*]], i8** [[A]]
29 // CHECK-NEXT: call void @objc_sync_enter(i8* [[AVAL]])
30 // CHECK-NEXT: store i8* [[AVAL]], i8** [[SYNC]]
31 // CHECK-NEXT: call void @objc_exception_try_enter
32 // CHECK: call i32 @_setjmp
34 // This is unreachable, but the optimizers can't know that.
35 // CHECK: call void asm sideeffect "", "=*m,=*m,=*m"(i8** [[A]], i8** [[SYNC]]
36 // CHECK: call void @objc_sync_exit
37 // CHECK: call i8* @objc_exception_extract
38 // CHECK: call void @objc_exception_throw
41 // CHECK: call void @objc_exception_try_exit
42 // CHECK: [[T:%.*]] = load i8** [[SYNC]]
43 // CHECK-NEXT: call void @objc_sync_exit
50 // CHECK: define i32 @f0(
52 // TODO: we can optimize the ret to a constant if we can figure out
53 // either that x isn't stored to within the synchronized block or
54 // that the synchronized block can't longjmp.
56 // CHECK: [[X:%.*]] = alloca i32
57 // CHECK: store i32 1, i32* [[X]]
59 @synchronized((x++, a)) {
62 // CHECK: [[T:%.*]] = load i32* [[X]]
63 // CHECK: ret i32 [[T]]
67 // CHECK: define void @f1(
69 // Check that the return doesn't go through the cleanup.
70 extern void opaque(void);
73 // CHECK: call void @opaque()
74 // CHECK-NEXT: ret void
76 @synchronized(({ return; }), a) {