Hans Wennborg | 7a00888 | 2016-05-24 20:40:51 +0000 | [diff] [blame^] | 1 | // Make sure -finline-functions family flags are behaving correctly. |
| 2 | |
| 3 | // RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck -check-prefix=NOINLINE %s |
| 4 | // RUN: %clang_cc1 -O3 -fno-inline-functions -emit-llvm %s -o - | FileCheck -check-prefix=NOINLINE %s |
| 5 | // RUN: %clang_cc1 -finline-functions -emit-llvm %s -o - | FileCheck -check-prefix=INLINE %s |
| 6 | |
| 7 | inline int inline_hint(int a, int b) { return(a+b); } |
| 8 | |
| 9 | int inline_no_hint(int a, int b) { return (a/b); } |
| 10 | |
| 11 | inline __attribute__ ((__always_inline__)) int inline_always(int a, int b) { return(a*b); } |
| 12 | |
| 13 | volatile int *pa = (int*) 0x1000; |
| 14 | void foo() { |
| 15 | // NOINLINE-LABEL: @foo |
| 16 | // INLINE-LABEL: @foo |
| 17 | // NOINLINE: call i32 @inline_hint |
| 18 | // INLINE-NOT: call i32 @inline_hint |
| 19 | pa[0] = inline_hint(pa[1],pa[2]); |
| 20 | // NOINLINE-NOT: call i32 @inline_always |
| 21 | // INLINE-NOT: call i32 @inline_always |
| 22 | pa[3] = inline_always(pa[4],pa[5]); |
| 23 | // NOINLINE: call i32 @inline_no_hint |
| 24 | // INLINE-NOT: call i32 @inline_no_hint |
| 25 | pa[6] = inline_no_hint(pa[7], pa[8]); |
| 26 | } |