extern-inline.c revision a4d71455f0d418e16cc0c5c5aa55a3bad3494aee
1// RUN: %clang -S -emit-llvm -std=gnu89 -o - %s | FileCheck %s
2// PR5253
3
4// If an extern inline function is redefined, functions should call the
5// redefinition.
6extern inline int f(int a) {return a;}
7int g(void) {return f(0);}
8// CHECK: call i32 @f
9int f(int b) {return 1+b;}
10// CHECK: load i32* %{{.*}}
11// CHECK: add nsw i32 1, %{{.*}}
12int h(void) {return f(1);}
13// CHECK: call i32 @f
14
15// It shouldn't matter if the function was redefined static.
16extern inline int f2(int a, int b) {return a+b;}
17int g2(void) {return f2(0,1);}
18// CHECK: call i32 @f2
19static int f2(int a, int b) {return a*b;}
20// CHECK: load i32* %{{.*}}
21// CHECK: load i32* %{{.*}}
22// CHECK: mul nsw i32 %{{.*}}, %{{.*}}
23int h2(void) {return f2(1,2);}
24// CHECK: call i32 @f2
25
26