36 lines · c
1// RUN: %clang_cc1 -emit-llvm -o - -triple x86_64-apple-darwin10 %s | FileCheck %s2// RUN: %clang_cc1 -O2 -fno-inline -emit-llvm -o - -triple x86_64-apple-darwin10 %s | FileCheck %s3// RUN: %clang_cc1 -flto -O2 -fno-inline -emit-llvm -o - -triple x86_64-apple-darwin10 %s | FileCheck %s -check-prefix=LTO4 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 case7// we should preserve them for link-time inlining decisions.8int x;9 10inline void f0(int y) { x = y; }11 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 @f016void test(void) {17 f0(17);18}19 20inline int __attribute__((always_inline)) f1(int x) {21 int blarg = 0;22 for (int i = 0; i < x; ++i)23 blarg = blarg + x * i;24 return blarg;25}26 27// CHECK: @test128// LTO: @test129int test1(int x) {30 // CHECK-NOT: call {{.*}} @f131 // CHECK: ret i3232 // LTO-NOT: call {{.*}} @f133 // LTO: ret i3234 return f1(x);35}36