1 // RUN: %clang_cc1 -triple powerpc-ibm-aix-xcoff -x c++ -emit-llvm \
2 // RUN: -fno-use-cxa-atexit < %s | \
3 // RUN: FileCheck --check-prefix=NO-REGISTER %s
4 // RUN: %clang_cc1 -triple powerpc64-ibm-aix-xcoff -x c++ -emit-llvm \
5 // RUN: -fno-use-cxa-atexit < %s | \
6 // RUN: FileCheck --check-prefix=NO-REGISTER %s
8 // RUN: %clang_cc1 -triple powerpc-ibm-aix-xcoff -x c++ -emit-llvm \
9 // RUN: -fno-use-cxa-atexit -fregister-global-dtors-with-atexit < %s | \
10 // RUN: FileCheck --check-prefix=REGISTER %s
11 // RUN: %clang_cc1 -triple powerpc64-ibm-aix-xcoff -x c++ -emit-llvm \
12 // RUN: -fno-use-cxa-atexit -fregister-global-dtors-with-atexit < %s | \
13 // RUN: FileCheck --check-prefix=REGISTER %s
20 int bar() __attribute__((destructor(100)));
21 int bar2() __attribute__((destructor(65535)));
22 int bar3(int) __attribute__((destructor(65535)));
36 // NO-REGISTER: @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 65535, ptr @_GLOBAL__sub_I__, ptr null }]
37 // NO-REGISTER: @llvm.global_dtors = appending global [4 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 100, ptr @_Z3barv, ptr null }, { i32, ptr, ptr } { i32 65535, ptr @_Z4bar2v, ptr null }, { i32, ptr, ptr } { i32 65535, ptr @_Z4bar3i, ptr null }, { i32, ptr, ptr } { i32 65535, ptr @_GLOBAL__D_a, ptr null }]
39 // REGISTER: @llvm.global_ctors = appending global [3 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 65535, ptr @_GLOBAL__sub_I__, ptr null }, { i32, ptr, ptr } { i32 100, ptr @__GLOBAL_init_100, ptr null }, { i32, ptr, ptr } { i32 65535, ptr @__GLOBAL_init_65535, ptr null }]
40 // REGISTER: @llvm.global_dtors = appending global [3 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 65535, ptr @_GLOBAL__D_a, ptr null }, { i32, ptr, ptr } { i32 100, ptr @__GLOBAL_cleanup_100, ptr null }, { i32, ptr, ptr } { i32 65535, ptr @__GLOBAL_cleanup_65535, ptr null }]
42 // REGISTER: define internal void @__GLOBAL_init_100() [[ATTR:#[0-9]+]] {
44 // REGISTER: %0 = call i32 @atexit(ptr @_Z3barv)
48 // REGISTER: define internal void @__GLOBAL_init_65535() [[ATTR:#[0-9]+]] {
50 // REGISTER: %0 = call i32 @atexit(ptr @_Z4bar2v)
51 // REGISTER: %1 = call i32 @atexit(ptr @_Z4bar3i)
55 // REGISTER: define internal void @__GLOBAL_cleanup_100() [[ATTR:#[0-9]+]] {
57 // REGISTER: %0 = call i32 @unatexit(ptr @_Z3barv)
58 // REGISTER: %needs_destruct = icmp eq i32 %0, 0
59 // REGISTER: br i1 %needs_destruct, label %destruct.call, label %destruct.end
61 // REGISTER: destruct.call:
62 // REGISTER: call void @_Z3barv()
63 // REGISTER: br label %destruct.end
65 // REGISTER: destruct.end:
69 // REGISTER: define internal void @__GLOBAL_cleanup_65535() [[ATTR:#[0-9]+]] {
71 // REGISTER: %0 = call i32 @unatexit(ptr @_Z4bar3i)
72 // REGISTER: %needs_destruct = icmp eq i32 %0, 0
73 // REGISTER: br i1 %needs_destruct, label %destruct.call, label %unatexit.call
75 // REGISTER: destruct.call:
76 // REGISTER: call void @_Z4bar3i()
77 // REGISTER: br label %unatexit.call
79 // REGISTER: unatexit.call:
80 // REGISTER: %1 = call i32 @unatexit(ptr @_Z4bar2v)
81 // REGISTER: %needs_destruct1 = icmp eq i32 %1, 0
82 // REGISTER: br i1 %needs_destruct1, label %destruct.call2, label %destruct.end
84 // REGISTER: destruct.call2:
85 // REGISTER: call void @_Z4bar2v()
86 // REGISTER: br label %destruct.end
88 // REGISTER: destruct.end: