inline-optsize.ll 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. ; RUN: opt -S -Oz < %s | FileCheck %s -check-prefix=OZ
  2. ; RUN: opt -S -O2 < %s | FileCheck %s -check-prefix=O2
  3. ; The inline threshold for a function with the optsize attribute is currently
  4. ; the same as the global inline threshold for -Os. Check that the optsize
  5. ; function attribute don't alter the function specific inline threshold if the
  6. ; global inline threshold is lower (as for -Oz).
  7. @a = global i32 4
  8. ; This function should be larger than the inline threshold for -Oz (25), but
  9. ; smaller than the inline threshold for optsize (75).
  10. define i32 @inner() {
  11. %a1 = load volatile i32, i32* @a
  12. %x1 = add i32 %a1, %a1
  13. %a2 = load volatile i32, i32* @a
  14. %x2 = add i32 %x1, %a2
  15. %a3 = load volatile i32, i32* @a
  16. %x3 = add i32 %x2, %a3
  17. %a4 = load volatile i32, i32* @a
  18. %x4 = add i32 %x3, %a4
  19. %a5 = load volatile i32, i32* @a
  20. %x5 = add i32 %x3, %a5
  21. ret i32 %x5
  22. }
  23. ; @inner() should be inlined for -O2 but not for -Oz.
  24. ; OZ: call
  25. ; O2-NOT: call
  26. define i32 @outer() optsize {
  27. %r = call i32 @inner()
  28. ret i32 %r
  29. }