xref: /aosp_15_r20/external/llvm/test/Feature/optnone-llc.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc -O1 -debug %s -o /dev/null 2>&1 | FileCheck %s --check-prefix=LLC-Ox
2*9880d681SAndroid Build Coastguard Worker; RUN: llc -O2 -debug %s -o /dev/null 2>&1 | FileCheck %s --check-prefix=LLC-Ox
3*9880d681SAndroid Build Coastguard Worker; RUN: llc -O3 -debug %s -o /dev/null 2>&1 | FileCheck %s --check-prefix=LLC-Ox
4*9880d681SAndroid Build Coastguard Worker; RUN: llc -misched-postra -debug %s -o /dev/null 2>&1 | FileCheck %s --check-prefix=LLC-MORE
5*9880d681SAndroid Build Coastguard Worker; RUN: llc -O1 -debug-only=isel %s -o /dev/null 2>&1 | FileCheck %s --check-prefix=FAST
6*9880d681SAndroid Build Coastguard Worker; RUN: llc -O1 -debug-only=isel -fast-isel=false %s -o /dev/null 2>&1 | FileCheck %s --check-prefix=NOFAST
7*9880d681SAndroid Build Coastguard Worker
8*9880d681SAndroid Build Coastguard Worker; REQUIRES: asserts, default_triple
9*9880d681SAndroid Build Coastguard Worker
10*9880d681SAndroid Build Coastguard Worker; This test verifies that we don't run Machine Function optimizations
11*9880d681SAndroid Build Coastguard Worker; on optnone functions, and that we can turn off FastISel.
12*9880d681SAndroid Build Coastguard Worker
13*9880d681SAndroid Build Coastguard Worker; Function Attrs: noinline optnone
14*9880d681SAndroid Build Coastguard Workerdefine i32 @_Z3fooi(i32 %x) #0 {
15*9880d681SAndroid Build Coastguard Workerentry:
16*9880d681SAndroid Build Coastguard Worker  %x.addr = alloca i32, align 4
17*9880d681SAndroid Build Coastguard Worker  store i32 %x, i32* %x.addr, align 4
18*9880d681SAndroid Build Coastguard Worker  br label %while.cond
19*9880d681SAndroid Build Coastguard Worker
20*9880d681SAndroid Build Coastguard Workerwhile.cond:                                       ; preds = %while.body, %entry
21*9880d681SAndroid Build Coastguard Worker  %0 = load i32, i32* %x.addr, align 4
22*9880d681SAndroid Build Coastguard Worker  %dec = add nsw i32 %0, -1
23*9880d681SAndroid Build Coastguard Worker  store i32 %dec, i32* %x.addr, align 4
24*9880d681SAndroid Build Coastguard Worker  %tobool = icmp ne i32 %0, 0
25*9880d681SAndroid Build Coastguard Worker  br i1 %tobool, label %while.body, label %while.end
26*9880d681SAndroid Build Coastguard Worker
27*9880d681SAndroid Build Coastguard Workerwhile.body:                                       ; preds = %while.cond
28*9880d681SAndroid Build Coastguard Worker  br label %while.cond
29*9880d681SAndroid Build Coastguard Worker
30*9880d681SAndroid Build Coastguard Workerwhile.end:                                        ; preds = %while.cond
31*9880d681SAndroid Build Coastguard Worker  ret i32 0
32*9880d681SAndroid Build Coastguard Worker}
33*9880d681SAndroid Build Coastguard Worker
34*9880d681SAndroid Build Coastguard Workerattributes #0 = { optnone noinline }
35*9880d681SAndroid Build Coastguard Worker
36*9880d681SAndroid Build Coastguard Worker; Nothing that runs at -O0 gets skipped.
37*9880d681SAndroid Build Coastguard Worker; LLC-O0-NOT: Skipping pass
38*9880d681SAndroid Build Coastguard Worker
39*9880d681SAndroid Build Coastguard Worker; Machine Function passes run at -O1 and higher.
40*9880d681SAndroid Build Coastguard Worker; LLC-Ox-DAG: Skipping pass 'Branch Probability Basic Block Placement'
41*9880d681SAndroid Build Coastguard Worker; LLC-Ox-DAG: Skipping pass 'CodeGen Prepare'
42*9880d681SAndroid Build Coastguard Worker; LLC-Ox-DAG: Skipping pass 'Control Flow Optimizer'
43*9880d681SAndroid Build Coastguard Worker; LLC-Ox-DAG: Skipping pass 'Machine code sinking'
44*9880d681SAndroid Build Coastguard Worker; LLC-Ox-DAG: Skipping pass 'Machine Common Subexpression Elimination'
45*9880d681SAndroid Build Coastguard Worker; LLC-Ox-DAG: Skipping pass 'Machine Copy Propagation Pass'
46*9880d681SAndroid Build Coastguard Worker; LLC-Ox-DAG: Skipping pass 'Machine Instruction Scheduler'
47*9880d681SAndroid Build Coastguard Worker; LLC-Ox-DAG: Skipping pass 'Machine Loop Invariant Code Motion'
48*9880d681SAndroid Build Coastguard Worker; LLC-Ox-DAG: Skipping pass 'Optimize machine instruction PHIs'
49*9880d681SAndroid Build Coastguard Worker; LLC-Ox-DAG: Skipping pass 'Peephole Optimizations'
50*9880d681SAndroid Build Coastguard Worker; LLC-Ox-DAG: Skipping pass 'Post{{.*}}RA{{.*}}{{[Ss]}}cheduler'
51*9880d681SAndroid Build Coastguard Worker; LLC-Ox-DAG: Skipping pass 'Remove dead machine instructions'
52*9880d681SAndroid Build Coastguard Worker; LLC-Ox-DAG: Skipping pass 'Tail Duplication'
53*9880d681SAndroid Build Coastguard Worker
54*9880d681SAndroid Build Coastguard Worker; Alternate post-RA scheduler.
55*9880d681SAndroid Build Coastguard Worker; LLC-MORE: Skipping pass 'PostRA Machine Instruction Scheduler'
56*9880d681SAndroid Build Coastguard Worker
57*9880d681SAndroid Build Coastguard Worker; Selectively disable FastISel for optnone functions.
58*9880d681SAndroid Build Coastguard Worker; FAST:   FastISel is enabled
59*9880d681SAndroid Build Coastguard Worker; NOFAST: FastISel is disabled
60