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