Charles Davis | f3f8d2a | 2010-02-18 02:00:42 +0000 | [diff] [blame] | 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. |
| 6 | extern inline int f(int a) {return a;} |
| 7 | int g(void) {return f(0);} |
| 8 | // CHECK: call i32 @f |
| 9 | int f(int b) {return 1+b;} |
| 10 | // CHECK: load i32* %{{.*}} |
| 11 | // CHECK: add nsw i32 1, %{{.*}} |
| 12 | int h(void) {return f(1);} |
| 13 | // CHECK: call i32 @f |
| 14 | |
| 15 | // It shouldn't matter if the function was redefined static. |
| 16 | extern inline int f2(int a, int b) {return a+b;} |
| 17 | int g2(void) {return f2(0,1);} |
| 18 | // CHECK: call i32 @f2 |
| 19 | static int f2(int a, int b) {return a*b;} |
| 20 | // CHECK: load i32* %{{.*}} |
| 21 | // CHECK: load i32* %{{.*}} |
| 22 | // CHECK: mul i32 %{{.*}}, %{{.*}} |
| 23 | int h2(void) {return f2(1,2);} |
| 24 | // CHECK: call i32 @f2 |
| 25 | |