Revert "[llvm] Improve llvm.objectsize computation by computing GEP, alloca and mallo...
[llvm-project.git] / clang / test / CodeGen / available-externally-suppress.c
blobb28e783e4bf8d9b13780bb574de6c40011209b79
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.
8 int x;
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
16 void test(void) {
17 f0(17);
20 inline 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;
27 // CHECK: @test1
28 // LTO: @test1
29 int test1(int x) {
30 // CHECK-NOT: call {{.*}} @f1
31 // CHECK: ret i32
32 // LTO-NOT: call {{.*}} @f1
33 // LTO: ret i32
34 return f1(x);