diff options
| author | Teresa Johnson <tejohnson@google.com> | 2015-06-10 17:49:45 +0000 |
|---|---|---|
| committer | Teresa Johnson <tejohnson@google.com> | 2015-06-10 17:49:45 +0000 |
| commit | 88c3c6799748a14a7decb48a31d4f99a72af1527 (patch) | |
| tree | d8ef43478108eaa3b12a53c56d8710d9338a7b54 /clang/test/CodeGen/available-externally-suppress.c | |
| parent | 232fa9af3b127a95d017e9cd4d764898d19916b2 (diff) | |
| download | bcm5719-llvm-88c3c6799748a14a7decb48a31d4f99a72af1527.tar.gz bcm5719-llvm-88c3c6799748a14a7decb48a31d4f99a72af1527.zip | |
Pass down the -flto option to the -cc1 job, and from there into the
CodeGenOptions and onto the PassManagerBuilder. This enables gating
the new EliminateAvailableExternally module pass on whether we are
preparing for LTO.
If we are preparing for LTO (e.g. a -flto -c compile), the new pass is not
included as we want to preserve available externally functions for possible
link time inlining.
llvm-svn: 239481
Diffstat (limited to 'clang/test/CodeGen/available-externally-suppress.c')
| -rw-r--r-- | clang/test/CodeGen/available-externally-suppress.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/test/CodeGen/available-externally-suppress.c b/clang/test/CodeGen/available-externally-suppress.c index 390d2017884..a25a2827127 100644 --- a/clang/test/CodeGen/available-externally-suppress.c +++ b/clang/test/CodeGen/available-externally-suppress.c @@ -1,12 +1,18 @@ // RUN: %clang_cc1 -emit-llvm -o - -triple x86_64-apple-darwin10 %s | FileCheck %s +// RUN: %clang_cc1 -O2 -fno-inline -emit-llvm -o - -triple x86_64-apple-darwin10 %s | FileCheck %s +// RUN: %clang_cc1 -flto -O2 -fno-inline -emit-llvm -o - -triple x86_64-apple-darwin10 %s | FileCheck %s -check-prefix=LTO // Ensure that we don't emit available_externally functions at -O0. +// Also should not emit them at -O2, unless -flto is present in which case +// we should preserve them for link-time inlining decisions. int x; inline void f0(int y) { x = y; } // CHECK-LABEL: define void @test() // CHECK: declare void @f0(i32) +// LTO-LABEL: define void @test() +// LTO: define available_externally void @f0 void test() { f0(17); } @@ -19,9 +25,13 @@ inline int __attribute__((always_inline)) f1(int x) { } // CHECK: @test1 +// LTO: @test1 int test1(int x) { // CHECK: br i1 // CHECK-NOT: call {{.*}} @f1 // CHECK: ret i32 + // LTO: br i1 + // LTO-NOT: call {{.*}} @f1 + // LTO: ret i32 return f1(x); } |

