Home | History | Annotate | Download | only in CodeGen
      1 // Make sure -finline-functions family flags are behaving correctly.
      2 
      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
      5 // RUN: %clang_cc1 -triple i686-pc-win32 -finline-hint-functions -emit-llvm %s -o - | FileCheck -check-prefix=HINT %s
      6 // RUN: %clang_cc1 -triple i686-pc-win32 -finline-functions -emit-llvm %s -o - | FileCheck -check-prefix=INLINE %s
      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
     17 // HINT-LABEL: @foo
     18 // INLINE-LABEL: @foo
     19 // NOINLINE: call i32 @inline_hint
     20 // HINT-NOT: call i32 @inline_hint
     21 // INLINE-NOT: call i32 @inline_hint
     22     pa[0] = inline_hint(pa[1],pa[2]);
     23 // NOINLINE-NOT: call i32 @inline_always
     24 // HINT-NOT: call i32 @inline_always
     25 // INLINE-NOT: call i32 @inline_always
     26     pa[3] = inline_always(pa[4],pa[5]);
     27 // NOINLINE: call i32 @inline_no_hint
     28 // HINT: call i32 @inline_no_hint
     29 // INLINE-NOT: call i32 @inline_no_hint
     30     pa[6] = inline_no_hint(pa[7], pa[8]);
     31 }
     32