diff options
author | Reid Kleckner <reid@kleckner.net> | 2015-04-22 19:37:32 +0000 |
---|---|---|
committer | Reid Kleckner <reid@kleckner.net> | 2015-04-22 19:37:32 +0000 |
commit | 1d980795e221c518afa53b2ca20ae778db33a1e0 (patch) | |
tree | 70e2d7110099e9a6a57cad107795c645564ad8ee /test/CodeGenCXX/global-init.cpp | |
parent | bfe1020980a88a6c8292de0f0669345042a93aa6 (diff) |
Set normal LLVM function attributes on global initializer functions
Otherwise -fno-omit-frame-pointer and other flags like it aren't
applied.
Basic idea taken from Gao's patch, thanks!
Differential Revision: http://reviews.llvm.org/D9203
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@235537 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/global-init.cpp')
-rw-r--r-- | test/CodeGenCXX/global-init.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/test/CodeGenCXX/global-init.cpp b/test/CodeGenCXX/global-init.cpp index a56ec248fd..e806af9eac 100644 --- a/test/CodeGenCXX/global-init.cpp +++ b/test/CodeGenCXX/global-init.cpp @@ -1,5 +1,8 @@ // RUN: %clang_cc1 -triple=x86_64-apple-darwin10 -emit-llvm -fexceptions %s -o - |FileCheck %s // RUN: %clang_cc1 -triple=x86_64-apple-darwin10 -emit-llvm %s -o - |FileCheck -check-prefix CHECK-NOEXC %s +// RUN: %clang_cc1 -triple=x86_64-apple-darwin10 -emit-llvm \ +// RUN: -momit-leaf-frame-pointer -mdisable-fp-elim %s -o - \ +// RUN: | FileCheck -check-prefix CHECK-FP %s struct A { A(); @@ -195,11 +198,15 @@ namespace test7 { // CHECK-NEXT: sub // CHECK-NEXT: store i32 {{.*}}, i32* @_ZN5test1L1yE -// CHECK: define internal void @_GLOBAL__sub_I_global_init.cpp() section "__TEXT,__StaticInit,regular,pure_instructions" { +// CHECK: define internal void @_GLOBAL__sub_I_global_init.cpp() #{{[0-9]+}} section "__TEXT,__StaticInit,regular,pure_instructions" { // CHECK: call void [[TEST1_Y_INIT]] // CHECK: call void [[TEST1_Z_INIT]] // rdar://problem/8090834: this should be nounwind // CHECK-NOEXC: define internal void @_GLOBAL__sub_I_global_init.cpp() [[NUW:#[0-9]+]] section "__TEXT,__StaticInit,regular,pure_instructions" { -// CHECK-NOEXC: attributes [[NUW]] = { nounwind } +// CHECK-NOEXC: attributes [[NUW]] = { nounwind{{.*}} } + +// PR21811: attach the appropriate attribute to the global init function +// CHECK-FP: define internal void @_GLOBAL__sub_I_global_init.cpp() [[NUX:#[0-9]+]] section "__TEXT,__StaticInit,regular,pure_instructions" { +// CHECK-FP: attributes [[NUX]] = { nounwind {{.*}}"no-frame-pointer-elim-non-leaf"{{.*}} } |