blob: 5dd9bfda574c98294e072510aaabeaad3949d77c [file] [log] [blame]
Charles Davisf3f8d2a2010-02-18 02:00:42 +00001// 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 i32 %{{.*}}, %{{.*}}
23int h2(void) {return f2(1,2);}
24// CHECK: call i32 @f2
25