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