Revert "[llvm] Improve llvm.objectsize computation by computing GEP, alloca and mallo...
[llvm-project.git] / clang / test / CodeGen / extern-inline.c
blobf5011be4301a1796ea841d50f26fd8706f349c7a
1 // RUN: %clang -target i386-unknown-unknown -S -emit-llvm -std=gnu89 -o - %s | FileCheck %s
2 // RUN: %clang -target i386-unknown-unknown -S -emit-llvm -fgnu89-inline -o - %s | FileCheck %s
3 // PR5253
5 // If an extern inline function is redefined, functions should call the
6 // redefinition.
7 extern inline int f(int a) {return a;}
8 int g(void) {return f(0);}
9 // CHECK: call i32 @f
10 int f(int b) {return 1+b;}
11 // CHECK: load i32, ptr %{{.*}}
12 // CHECK: add nsw i32 1, %{{.*}}
13 int h(void) {return f(1);}
14 // CHECK: call i32 @f
16 // It shouldn't matter if the function was redefined static.
17 extern inline int f2(int a, int b) {return a+b;}
18 int g2(void) {return f2(0,1);}
19 // CHECK: call i32 @f2
20 static int f2(int a, int b) {return a*b;}
21 // CHECK: load i32, ptr %{{.*}}
22 // CHECK: load i32, ptr %{{.*}}
23 // CHECK: mul nsw i32 %{{.*}}, %{{.*}}
24 int h2(void) {return f2(1,2);}
25 // CHECK: call i32 @f2