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 Sambucinline 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 Sambucvoid test() { 11*f4a2713aSLionel Sambuc f0(17); 12*f4a2713aSLionel Sambuc } 13*f4a2713aSLionel Sambuc f1(int x)14*f4a2713aSLionel Sambucinline 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 Sambucint 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