2016-05-25 04:40:51 +08:00
|
|
|
// Make sure -finline-functions family flags are behaving correctly.
|
|
|
|
|
2016-05-25 07:37:56 +08:00
|
|
|
// RUN: %clang_cc1 -triple i686-pc-win32 -emit-llvm %s -o - | FileCheck -check-prefix=NOINLINE %s
|
|
|
|
// RUN: %clang_cc1 -triple i686-pc-win32 -O3 -fno-inline-functions -emit-llvm %s -o - | FileCheck -check-prefix=NOINLINE %s
|
2016-06-23 00:56:16 +08:00
|
|
|
// RUN: %clang_cc1 -triple i686-pc-win32 -finline-hint-functions -emit-llvm %s -o - | FileCheck -check-prefix=HINT %s
|
2016-05-25 07:37:56 +08:00
|
|
|
// RUN: %clang_cc1 -triple i686-pc-win32 -finline-functions -emit-llvm %s -o - | FileCheck -check-prefix=INLINE %s
|
2016-05-25 04:40:51 +08:00
|
|
|
|
|
|
|
inline int inline_hint(int a, int b) { return(a+b); }
|
|
|
|
|
|
|
|
int inline_no_hint(int a, int b) { return (a/b); }
|
|
|
|
|
|
|
|
inline __attribute__ ((__always_inline__)) int inline_always(int a, int b) { return(a*b); }
|
|
|
|
|
|
|
|
volatile int *pa = (int*) 0x1000;
|
|
|
|
void foo() {
|
|
|
|
// NOINLINE-LABEL: @foo
|
2016-06-23 00:56:16 +08:00
|
|
|
// HINT-LABEL: @foo
|
2016-05-25 04:40:51 +08:00
|
|
|
// INLINE-LABEL: @foo
|
|
|
|
// NOINLINE: call i32 @inline_hint
|
2016-06-23 00:56:16 +08:00
|
|
|
// HINT-NOT: call i32 @inline_hint
|
2016-05-25 04:40:51 +08:00
|
|
|
// INLINE-NOT: call i32 @inline_hint
|
|
|
|
pa[0] = inline_hint(pa[1],pa[2]);
|
|
|
|
// NOINLINE-NOT: call i32 @inline_always
|
2016-06-23 00:56:16 +08:00
|
|
|
// HINT-NOT: call i32 @inline_always
|
2016-05-25 04:40:51 +08:00
|
|
|
// INLINE-NOT: call i32 @inline_always
|
|
|
|
pa[3] = inline_always(pa[4],pa[5]);
|
|
|
|
// NOINLINE: call i32 @inline_no_hint
|
2016-06-23 00:56:16 +08:00
|
|
|
// HINT: call i32 @inline_no_hint
|
2016-05-25 04:40:51 +08:00
|
|
|
// INLINE-NOT: call i32 @inline_no_hint
|
|
|
|
pa[6] = inline_no_hint(pa[7], pa[8]);
|
|
|
|
}
|