xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGen/available-externally-suppress.c (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -emit-llvm -o - -triple x86_64-apple-darwin10 %s | FileCheck %s
2*f4a2713aSLionel Sambuc 
3*f4a2713aSLionel Sambuc // Ensure that we don't emit available_externally functions at -O0.
4*f4a2713aSLionel Sambuc int x;
5*f4a2713aSLionel Sambuc 
f0(int y)6*f4a2713aSLionel Sambuc inline void f0(int y) { x = y; }
7*f4a2713aSLionel Sambuc 
8*f4a2713aSLionel Sambuc // CHECK-LABEL: define void @test()
9*f4a2713aSLionel Sambuc // CHECK: declare void @f0(i32)
test()10*f4a2713aSLionel Sambuc void test() {
11*f4a2713aSLionel Sambuc   f0(17);
12*f4a2713aSLionel Sambuc }
13*f4a2713aSLionel Sambuc 
f1(int x)14*f4a2713aSLionel Sambuc inline int __attribute__((always_inline)) f1(int x) {
15*f4a2713aSLionel Sambuc   int blarg = 0;
16*f4a2713aSLionel Sambuc   for (int i = 0; i < x; ++i)
17*f4a2713aSLionel Sambuc     blarg = blarg + x * i;
18*f4a2713aSLionel Sambuc   return blarg;
19*f4a2713aSLionel Sambuc }
20*f4a2713aSLionel Sambuc 
21*f4a2713aSLionel Sambuc // CHECK: @test1
test1(int x)22*f4a2713aSLionel Sambuc int test1(int x) {
23*f4a2713aSLionel Sambuc   // CHECK: br i1
24*f4a2713aSLionel Sambuc   // CHECK-NOT: call {{.*}} @f1
25*f4a2713aSLionel Sambuc   // CHECK: ret i32
26*f4a2713aSLionel Sambuc   return f1(x);
27*f4a2713aSLionel Sambuc }
28