1 ; RUN: opt -S -passes=objc-arc-apelim < %s | FileCheck %s
4 @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 }]
8 declare i32 @bar() nounwind
10 define i32 @foo() nounwind {
15 define internal void @__cxx_global_var_init() {
17 %call = call i32 @foo()
18 store i32 %call, ptr @x, align 4
22 define internal void @__dxx_global_var_init() {
24 %call = call i32 @bar()
25 store i32 %call, ptr @x, align 4
29 ; CHECK: define internal void @_GLOBAL__I_x() {
32 define internal void @_GLOBAL__I_x() {
34 %0 = call ptr @llvm.objc.autoreleasePoolPush() nounwind
35 call void @__cxx_global_var_init()
36 call void @llvm.objc.autoreleasePoolPop(ptr %0) nounwind
40 ; CHECK: define internal void @_GLOBAL__I_y() {
41 ; CHECK: %0 = call ptr @llvm.objc.autoreleasePoolPush() [[NUW:#[0-9]+]]
42 ; CHECK: call void @llvm.objc.autoreleasePoolPop(ptr %0) [[NUW]]
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)
55 ; CHECK: attributes #0 = { nounwind }