1 // Make sure -finline-functions family flags are behaving correctly.
2 //
3 // REQUIRES: x86-registered-target
4 //
5 // RUN: %clang_cc1 -triple i686-pc-win32 -emit-llvm %s -o - | FileCheck -check-prefix=NOINLINE %s
6 // RUN: %clang_cc1 -triple i686-pc-win32 -fexperimental-new-pass-manager -emit-llvm %s -o - | FileCheck -check-prefix=NOINLINE %s
7 // RUN: %clang_cc1 -triple i686-pc-win32 -O3 -fno-inline-functions -emit-llvm %s -o - | FileCheck -check-prefix=NOINLINE %s
8 // RUN: %clang_cc1 -triple i686-pc-win32 -fexperimental-new-pass-manager -O3 -fno-inline-functions -emit-llvm %s -o - | FileCheck -check-prefix=NOINLINE %s
9 // RUN: %clang_cc1 -triple i686-pc-win32 -O3 -finline-hint-functions -emit-llvm %s -o - | FileCheck -check-prefix=HINT %s
10 // RUN: %clang_cc1 -triple i686-pc-win32 -fexperimental-new-pass-manager -O3 -finline-hint-functions -emit-llvm %s -o - | FileCheck -check-prefix=HINT %s
11 // RUN: %clang_cc1 -triple i686-pc-win32 -O3 -finline-functions -emit-llvm %s -o - | FileCheck -check-prefix=INLINE %s
12 // RUN: %clang_cc1 -triple i686-pc-win32 -fexperimental-new-pass-manager -O3 -finline-functions -emit-llvm %s -o - | FileCheck -check-prefix=INLINE %s
13 
14 inline int inline_hint(int a, int b) { return(a+b); }
15 
16 int inline_no_hint(int a, int b) { return (a/b); }
17 
18 inline __attribute__ ((__always_inline__)) int inline_always(int a, int b) { return(a*b); }
19 
20 volatile int *pa = (int*) 0x1000;
21 void foo() {
22 // NOINLINE-LABEL: @foo
23 // HINT-LABEL: @foo
24 // INLINE-LABEL: @foo
25 // NOINLINE: call i32 @inline_hint
26 // HINT-NOT: call i32 @inline_hint
27 // INLINE-NOT: call i32 @inline_hint
28     pa[0] = inline_hint(pa[1],pa[2]);
29 // NOINLINE-NOT: call i32 @inline_always
30 // HINT-NOT: call i32 @inline_always
31 // INLINE-NOT: call i32 @inline_always
32     pa[3] = inline_always(pa[4],pa[5]);
33 // NOINLINE: call i32 @inline_no_hint
34 // HINT: call i32 @inline_no_hint
35 // INLINE-NOT: call i32 @inline_no_hint
36     pa[6] = inline_no_hint(pa[7], pa[8]);
37 }
38