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
4
5// If an extern inline function is redefined, functions should call the
6// redefinition.
7extern inline int f(int a) {return a;}
8int g(void) {return f(0);}
9// CHECK: call i32 @f
10int f(int b) {return 1+b;}
11// CHECK: load i32* %{{.*}}
12// CHECK: add nsw i32 1, %{{.*}}
13int h(void) {return f(1);}
14// CHECK: call i32 @f
15
16// It shouldn't matter if the function was redefined static.
17extern inline int f2(int a, int b) {return a+b;}
18int g2(void) {return f2(0,1);}
19// CHECK: call i32 @f2
20static int f2(int a, int b) {return a*b;}
21// CHECK: load i32* %{{.*}}
22// CHECK: load i32* %{{.*}}
23// CHECK: mul nsw i32 %{{.*}}, %{{.*}}
24int h2(void) {return f2(1,2);}
25// CHECK: call i32 @f2
26
27