1 // RUN: %clang_cc1 -emit-llvm -o - -triple x86_64-apple-darwin10 %s | FileCheck %s
2 // RUN: %clang_cc1 -O2 -fno-inline -emit-llvm -o - -triple x86_64-apple-darwin10 %s | FileCheck %s
3 // RUN: %clang_cc1 -flto -O2 -fno-inline -emit-llvm -o - -triple x86_64-apple-darwin10 %s | FileCheck %s -check-prefix=LTO
5 // Ensure that we don't emit available_externally functions at -O0.
6 // Also should not emit them at -O2, unless -flto is present in which case
7 // we should preserve them for link-time inlining decisions.
10 inline void f0(int y
) { x
= y
; }
12 // CHECK-LABEL: define{{.*}} void @test()
13 // CHECK: declare void @f0(i32 noundef)
14 // LTO-LABEL: define{{.*}} void @test()
15 // LTO: define available_externally void @f0
20 inline int __attribute__((always_inline
)) f1(int x
) {
22 for (int i
= 0; i
< x
; ++i
)
23 blarg
= blarg
+ x
* i
;
30 // CHECK-NOT: call {{.*}} @f1
32 // LTO-NOT: call {{.*}} @f1