1 ; RUN: opt -S -objc-arc-apelim < %s | FileCheck %s
2 ; RUN: opt -S -passes=objc-arc-apelim < %s | FileCheck %s
5 @llvm.global_ctors = appending global [2 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__I_x, i8* null }, { i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__I_y, i8* null }]
9 declare i32 @bar() nounwind
11 define i32 @foo() nounwind {
16 define internal void @__cxx_global_var_init() {
18 %call = call i32 @foo()
19 store i32 %call, i32* @x, align 4
23 define internal void @__dxx_global_var_init() {
25 %call = call i32 @bar()
26 store i32 %call, i32* @x, align 4
30 ; CHECK: define internal void @_GLOBAL__I_x() {
33 define internal void @_GLOBAL__I_x() {
35 %0 = call i8* @llvm.objc.autoreleasePoolPush() nounwind
36 call void @__cxx_global_var_init()
37 call void @llvm.objc.autoreleasePoolPop(i8* %0) nounwind
41 ; CHECK: define internal void @_GLOBAL__I_y() {
42 ; CHECK: %0 = call i8* @llvm.objc.autoreleasePoolPush() [[NUW:#[0-9]+]]
43 ; CHECK: call void @llvm.objc.autoreleasePoolPop(i8* %0) [[NUW]]
45 define internal void @_GLOBAL__I_y() {
47 %0 = call i8* @llvm.objc.autoreleasePoolPush() nounwind
48 call void @__dxx_global_var_init()
49 call void @llvm.objc.autoreleasePoolPop(i8* %0) nounwind
53 declare i8* @llvm.objc.autoreleasePoolPush()
54 declare void @llvm.objc.autoreleasePoolPop(i8*)
56 ; CHECK: attributes #0 = { nounwind }