[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / CodeGen / inline-optim.c
blobe9f75b4c05d0a574fa42b3b9fc2133ba00e317e0
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 -O3 -fno-inline-functions -emit-llvm %s -o - | FileCheck -check-prefix=NOINLINE %s
7 // RUN: %clang_cc1 -triple i686-pc-win32 -O3 -finline-hint-functions -emit-llvm %s -o - | FileCheck -check-prefix=HINT %s
8 // RUN: %clang_cc1 -triple i686-pc-win32 -O3 -finline-functions -emit-llvm %s -o - | FileCheck -check-prefix=INLINE %s
10 inline int inline_hint(int a, int b) { return(a+b); }
12 int inline_no_hint(int a, int b) { return (a/b); }
14 inline __attribute__ ((__always_inline__)) int inline_always(int a, int b) { return(a*b); }
16 volatile int *pa = (int*) 0x1000;
17 void foo(void) {
18 // NOINLINE-LABEL: @foo
19 // HINT-LABEL: @foo
20 // INLINE-LABEL: @foo
21 // NOINLINE: call i32 @inline_hint
22 // HINT-NOT: call i32 @inline_hint
23 // INLINE-NOT: call i32 @inline_hint
24 pa[0] = inline_hint(pa[1],pa[2]);
25 // NOINLINE-NOT: call i32 @inline_always
26 // HINT-NOT: call i32 @inline_always
27 // INLINE-NOT: call i32 @inline_always
28 pa[3] = inline_always(pa[4],pa[5]);
29 // NOINLINE: call i32 @inline_no_hint
30 // HINT: call i32 @inline_no_hint
31 // INLINE-NOT: call i32 @inline_no_hint
32 pa[6] = inline_no_hint(pa[7], pa[8]);