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 7 ; REQUIRES: asserts 8 9 ; This test verifies that we don't run Machine Function optimizations 10 ; on optnone functions. 11 12 ; Function Attrs: noinline optnone 13 define i32 @_Z3fooi(i32 %x) #0 { 14 entry: 15 %x.addr = alloca i32, align 4 16 store i32 %x, i32* %x.addr, align 4 17 br label %while.cond 18 19 while.cond: ; preds = %while.body, %entry 20 %0 = load i32* %x.addr, align 4 21 %dec = add nsw i32 %0, -1 22 store i32 %dec, i32* %x.addr, align 4 23 %tobool = icmp ne i32 %0, 0 24 br i1 %tobool, label %while.body, label %while.end 25 26 while.body: ; preds = %while.cond 27 br label %while.cond 28 29 while.end: ; preds = %while.cond 30 ret i32 0 31 } 32 33 attributes #0 = { optnone noinline } 34 35 ; Nothing that runs at -O0 gets skipped. 36 ; LLC-O0-NOT: Skipping pass 37 38 ; Machine Function passes run at -O1 and higher. 39 ; LLC-Ox-DAG: Skipping pass 'Branch Probability Basic Block Placement' 40 ; LLC-Ox-DAG: Skipping pass 'CodeGen Prepare' 41 ; LLC-Ox-DAG: Skipping pass 'Control Flow Optimizer' 42 ; LLC-Ox-DAG: Skipping pass 'Machine code sinking' 43 ; LLC-Ox-DAG: Skipping pass 'Machine Common Subexpression Elimination' 44 ; LLC-Ox-DAG: Skipping pass 'Machine Copy Propagation Pass' 45 ; LLC-Ox-DAG: Skipping pass 'Machine Loop Invariant Code Motion' 46 ; LLC-Ox-DAG: Skipping pass 'Merge disjoint stack slots' 47 ; LLC-Ox-DAG: Skipping pass 'Optimize machine instruction PHIs' 48 ; LLC-Ox-DAG: Skipping pass 'Peephole Optimizations' 49 ; LLC-Ox-DAG: Skipping pass 'Post RA top-down list latency scheduler' 50 ; LLC-Ox-DAG: Skipping pass 'Remove dead machine instructions' 51 ; LLC-Ox-DAG: Skipping pass 'Tail Duplication' 52 53 ; Alternate post-RA scheduler. 54 ; LLC-MORE: Skipping pass 'PostRA Machine Instruction Scheduler' 55