1 ; RUN: opt -S -passes=objc-arc-apelim < %s | FileCheck %s
5 @llvm.global_ctors = appending global [2 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 65535, ptr @_GLOBAL__I_x, ptr null }, { i32, ptr, ptr } { i32 65535, ptr @_GLOBAL__I_y, ptr null }]
9 declare i32 @bar() nounwind
11 define linkonce_odr i32 @foo() nounwind {
16 define internal void @__cxx_global_var_init() {
18 %call = call i32 @foo()
19 store i32 %call, ptr @x, align 4
23 define internal void @__dxx_global_var_init() {
25 %call = call i32 @bar()
26 store i32 %call, ptr @x, align 4
30 ; CHECK-LABEL: define internal void @_GLOBAL__I_x() {
31 define internal void @_GLOBAL__I_x() {
33 ; CHECK: call ptr @llvm.objc.autoreleasePoolPush()
34 ; CHECK-NEXT: call void @__cxx_global_var_init()
35 ; CHECK-NEXT: call void @llvm.objc.autoreleasePoolPop(ptr %0)
36 ; CHECK-NEXT: ret void
38 %0 = call ptr @llvm.objc.autoreleasePoolPush() nounwind
39 call void @__cxx_global_var_init()
40 call void @llvm.objc.autoreleasePoolPop(ptr %0) nounwind
44 define internal void @_GLOBAL__I_y() {
46 %0 = call ptr @llvm.objc.autoreleasePoolPush() nounwind
47 call void @__dxx_global_var_init()
48 call void @llvm.objc.autoreleasePoolPop(ptr %0) nounwind
52 declare ptr @llvm.objc.autoreleasePoolPush()
53 declare void @llvm.objc.autoreleasePoolPop(ptr)