optnone-llc.ll 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. ; RUN: llc -O0 -debug %s -o /dev/null 2>&1 | FileCheck %s --check-prefix=LLC-O0
  2. ; RUN: llc -O1 -debug %s -o /dev/null 2>&1 | FileCheck %s --check-prefix=LLC-Ox
  3. ; RUN: llc -O2 -debug %s -o /dev/null 2>&1 | FileCheck %s --check-prefix=LLC-Ox
  4. ; RUN: llc -O3 -debug %s -o /dev/null 2>&1 | FileCheck %s --check-prefix=LLC-Ox
  5. ; RUN: llc -misched-postra -debug %s -o /dev/null 2>&1 | FileCheck %s --check-prefix=LLC-MORE
  6. ; REQUIRES: asserts
  7. ; This test verifies that we don't run Machine Function optimizations
  8. ; on optnone functions.
  9. ; Function Attrs: noinline optnone
  10. define i32 @_Z3fooi(i32 %x) #0 {
  11. entry:
  12. %x.addr = alloca i32, align 4
  13. store i32 %x, i32* %x.addr, align 4
  14. br label %while.cond
  15. while.cond: ; preds = %while.body, %entry
  16. %0 = load i32, i32* %x.addr, align 4
  17. %dec = add nsw i32 %0, -1
  18. store i32 %dec, i32* %x.addr, align 4
  19. %tobool = icmp ne i32 %0, 0
  20. br i1 %tobool, label %while.body, label %while.end
  21. while.body: ; preds = %while.cond
  22. br label %while.cond
  23. while.end: ; preds = %while.cond
  24. ret i32 0
  25. }
  26. attributes #0 = { optnone noinline }
  27. ; Nothing that runs at -O0 gets skipped.
  28. ; LLC-O0-NOT: Skipping pass
  29. ; Machine Function passes run at -O1 and higher.
  30. ; LLC-Ox-DAG: Skipping pass 'Branch Probability Basic Block Placement'
  31. ; LLC-Ox-DAG: Skipping pass 'CodeGen Prepare'
  32. ; LLC-Ox-DAG: Skipping pass 'Control Flow Optimizer'
  33. ; LLC-Ox-DAG: Skipping pass 'Machine code sinking'
  34. ; LLC-Ox-DAG: Skipping pass 'Machine Common Subexpression Elimination'
  35. ; LLC-Ox-DAG: Skipping pass 'Machine Copy Propagation Pass'
  36. ; LLC-Ox-DAG: Skipping pass 'Machine Loop Invariant Code Motion'
  37. ; LLC-Ox-DAG: Skipping pass 'Merge disjoint stack slots'
  38. ; LLC-Ox-DAG: Skipping pass 'Optimize machine instruction PHIs'
  39. ; LLC-Ox-DAG: Skipping pass 'Peephole Optimizations'
  40. ; LLC-Ox-DAG: Skipping pass 'Post{{.*}}RA{{.*}}{{[Ss]}}cheduler'
  41. ; LLC-Ox-DAG: Skipping pass 'Remove dead machine instructions'
  42. ; LLC-Ox-DAG: Skipping pass 'Tail Duplication'
  43. ; Alternate post-RA scheduler.
  44. ; LLC-MORE: Skipping pass 'PostRA Machine Instruction Scheduler'