1*9880d681SAndroid Build Coastguard Worker; RUN: opt -S -objc-arc-apelim < %s | FileCheck %s 2*9880d681SAndroid Build Coastguard Worker 3*9880d681SAndroid Build Coastguard Worker; See PR26774 4*9880d681SAndroid Build Coastguard Worker 5*9880d681SAndroid Build Coastguard Worker@llvm.global_ctors = appending global [2 x { i32, void ()* }] [{ i32, void ()* } { i32 65535, void ()* @_GLOBAL__I_x }, { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I_y }] 6*9880d681SAndroid Build Coastguard Worker 7*9880d681SAndroid Build Coastguard Worker@x = global i32 0 8*9880d681SAndroid Build Coastguard Worker 9*9880d681SAndroid Build Coastguard Workerdeclare i32 @bar() nounwind 10*9880d681SAndroid Build Coastguard Worker 11*9880d681SAndroid Build Coastguard Workerdefine linkonce_odr i32 @foo() nounwind { 12*9880d681SAndroid Build Coastguard Workerentry: 13*9880d681SAndroid Build Coastguard Worker ret i32 5 14*9880d681SAndroid Build Coastguard Worker} 15*9880d681SAndroid Build Coastguard Worker 16*9880d681SAndroid Build Coastguard Workerdefine internal void @__cxx_global_var_init() { 17*9880d681SAndroid Build Coastguard Workerentry: 18*9880d681SAndroid Build Coastguard Worker %call = call i32 @foo() 19*9880d681SAndroid Build Coastguard Worker store i32 %call, i32* @x, align 4 20*9880d681SAndroid Build Coastguard Worker ret void 21*9880d681SAndroid Build Coastguard Worker} 22*9880d681SAndroid Build Coastguard Worker 23*9880d681SAndroid Build Coastguard Workerdefine internal void @__dxx_global_var_init() { 24*9880d681SAndroid Build Coastguard Workerentry: 25*9880d681SAndroid Build Coastguard Worker %call = call i32 @bar() 26*9880d681SAndroid Build Coastguard Worker store i32 %call, i32* @x, align 4 27*9880d681SAndroid Build Coastguard Worker ret void 28*9880d681SAndroid Build Coastguard Worker} 29*9880d681SAndroid Build Coastguard Worker 30*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: define internal void @_GLOBAL__I_x() { 31*9880d681SAndroid Build Coastguard Workerdefine internal void @_GLOBAL__I_x() { 32*9880d681SAndroid Build Coastguard Workerentry: 33*9880d681SAndroid Build Coastguard Worker; CHECK: call i8* @objc_autoreleasePoolPush() 34*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: call void @__cxx_global_var_init() 35*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: call void @objc_autoreleasePoolPop(i8* %0) 36*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: ret void 37*9880d681SAndroid Build Coastguard Worker 38*9880d681SAndroid Build Coastguard Worker %0 = call i8* @objc_autoreleasePoolPush() nounwind 39*9880d681SAndroid Build Coastguard Worker call void @__cxx_global_var_init() 40*9880d681SAndroid Build Coastguard Worker call void @objc_autoreleasePoolPop(i8* %0) nounwind 41*9880d681SAndroid Build Coastguard Worker ret void 42*9880d681SAndroid Build Coastguard Worker} 43*9880d681SAndroid Build Coastguard Worker 44*9880d681SAndroid Build Coastguard Workerdefine internal void @_GLOBAL__I_y() { 45*9880d681SAndroid Build Coastguard Workerentry: 46*9880d681SAndroid Build Coastguard Worker %0 = call i8* @objc_autoreleasePoolPush() nounwind 47*9880d681SAndroid Build Coastguard Worker call void @__dxx_global_var_init() 48*9880d681SAndroid Build Coastguard Worker call void @objc_autoreleasePoolPop(i8* %0) nounwind 49*9880d681SAndroid Build Coastguard Worker ret void 50*9880d681SAndroid Build Coastguard Worker} 51*9880d681SAndroid Build Coastguard Worker 52*9880d681SAndroid Build Coastguard Workerdeclare i8* @objc_autoreleasePoolPush() 53*9880d681SAndroid Build Coastguard Workerdeclare void @objc_autoreleasePoolPop(i8*) 54