Douglas Gregor | 44eac33 | 2010-07-13 06:02:28 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -emit-llvm -o - -O0 -triple x86_64-apple-darwin10 %s | FileCheck %s |
| 2 | |
| 3 | // Ensure that we don't emit available_externally functions at -O0. |
| 4 | int x; |
| 5 | |
| 6 | inline void f0(int y) { x = y; } |
| 7 | |
| 8 | // CHECK: define void @test() |
| 9 | // CHECK: declare void @f0(i32) |
| 10 | void test() { |
| 11 | f0(17); |
| 12 | } |
Douglas Gregor | 7feaeee | 2010-07-15 22:58:18 +0000 | [diff] [blame] | 13 | |
| 14 | inline int __attribute__((always_inline)) f1(int x) { |
| 15 | int blarg = 0; |
| 16 | for (int i = 0; i < x; ++i) |
| 17 | blarg = blarg + x * i; |
| 18 | return blarg; |
| 19 | } |
| 20 | |
Douglas Gregor | 1ce377a | 2010-07-15 23:04:05 +0000 | [diff] [blame] | 21 | // CHECK: @test1 |
Douglas Gregor | 7feaeee | 2010-07-15 22:58:18 +0000 | [diff] [blame] | 22 | int test1(int x) { |
| 23 | // CHECK: br i1 |
| 24 | // CHECK-NOT: call |
| 25 | // CHECK: ret i32 |
| 26 | return f1(x); |
| 27 | } |