Home | History | Annotate | Download | only in Inline
      1 ; RUN: opt -S -Oz < %s | FileCheck %s -check-prefix=OZ
      2 ; RUN: opt -S -O2 < %s | FileCheck %s -check-prefix=O2
      3 ; RUN: opt -S -Os < %s | FileCheck %s -check-prefix=OS
      4 
      5 ; The inline threshold for a function with the optsize attribute is currently
      6 ; the same as the global inline threshold for -Os. Check that the optsize
      7 ; function attribute doesn't alter the function-specific inline threshold if the
      8 ; global inline threshold is lower (as for -Oz).
      9 
     10 @a = global i32 4
     11 
     12 ; This function should be larger than the inline threshold for -Oz (25), but
     13 ; smaller than the inline threshold for optsize (75).
     14 define i32 @inner() {
     15   %a1 = load volatile i32, i32* @a
     16   %x1 = add i32 %a1,  %a1
     17   %a2 = load volatile i32, i32* @a
     18   %x2 = add i32 %x1, %a2
     19   %a3 = load volatile i32, i32* @a
     20   %x3 = add i32 %x2, %a3
     21   %a4 = load volatile i32, i32* @a
     22   %x4 = add i32 %x3, %a4
     23   %a5 = load volatile i32, i32* @a
     24   %x5 = add i32 %x3, %a5
     25   ret i32 %x5
     26 }
     27 
     28 ; @inner() should be inlined for -O2 and -Os but not for -Oz.
     29 ; OZ: call
     30 ; O2-NOT: call
     31 ; OS-NOT: call
     32 define i32 @outer() optsize {
     33    %r = call i32 @inner()
     34    ret i32 %r
     35 }
     36 
     37 ; @inner() should not be inlined for -O2, -Os and -Oz.
     38 ; OZ: call
     39 ; O2: call
     40 ; OS: call
     41 define i32 @outer2() minsize {
     42    %r = call i32 @inner()
     43    ret i32 %r
     44 }
     45