Home | History | Annotate | Download | only in ObjCARC
      1 ; RUN: opt -S -objc-arc-apelim < %s | FileCheck %s
      2 ; rdar://10227311
      3 
      4 @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 }]
      5 
      6 @x = global i32 0
      7 
      8 declare i32 @bar() nounwind
      9 
     10 define i32 @foo() nounwind {
     11 entry:
     12   ret i32 5
     13 }
     14 
     15 define internal void @__cxx_global_var_init() {
     16 entry:
     17   %call = call i32 @foo()
     18   store i32 %call, i32* @x, align 4
     19   ret void
     20 }
     21 
     22 define internal void @__dxx_global_var_init() {
     23 entry:
     24   %call = call i32 @bar()
     25   store i32 %call, i32* @x, align 4
     26   ret void
     27 }
     28 
     29 ; CHECK: define internal void @_GLOBAL__I_x() {
     30 ; CHECK-NOT: @objc
     31 ; CHECK: }
     32 define internal void @_GLOBAL__I_x() {
     33 entry:
     34   %0 = call i8* @objc_autoreleasePoolPush() nounwind
     35   call void @__cxx_global_var_init()
     36   call void @objc_autoreleasePoolPop(i8* %0) nounwind
     37   ret void
     38 }
     39 
     40 ; CHECK: define internal void @_GLOBAL__I_y() {
     41 ; CHECK: %0 = call i8* @objc_autoreleasePoolPush() [[NUW:#[0-9]+]]
     42 ; CHECK: call void @objc_autoreleasePoolPop(i8* %0) [[NUW]]
     43 ; CHECK: }
     44 define internal void @_GLOBAL__I_y() {
     45 entry:
     46   %0 = call i8* @objc_autoreleasePoolPush() nounwind
     47   call void @__dxx_global_var_init()
     48   call void @objc_autoreleasePoolPop(i8* %0) nounwind
     49   ret void
     50 }
     51 
     52 declare i8* @objc_autoreleasePoolPush()
     53 declare void @objc_autoreleasePoolPop(i8*)
     54 
     55 ; CHECK: attributes #0 = { nounwind }
     56