Paul Robinson | 2684ddd | 2014-02-06 00:07:05 +0000 | [diff] [blame] | 1 | ; RUN: opt -S -debug %s 2>&1 | FileCheck %s --check-prefix=OPT-O0 |
| 2 | ; RUN: opt -O1 -S -debug %s 2>&1 | FileCheck %s --check-prefix=OPT-O1 |
| 3 | ; RUN: opt -O2 -S -debug %s 2>&1 | FileCheck %s --check-prefix=OPT-O1 --check-prefix=OPT-O2O3 |
| 4 | ; RUN: opt -O3 -S -debug %s 2>&1 | FileCheck %s --check-prefix=OPT-O1 --check-prefix=OPT-O2O3 |
Chandler Carruth | cebf346 | 2017-06-30 07:09:08 +0000 | [diff] [blame] | 5 | ; RUN: opt -dce -die -gvn-hoist -loweratomic -S -debug %s 2>&1 | FileCheck %s --check-prefix=OPT-MORE |
Chandler Carruth | 7781850 | 2018-05-25 01:32:36 +0000 | [diff] [blame] | 6 | ; RUN: opt -indvars -licm -loop-deletion -loop-extract -loop-idiom -loop-instsimplify -loop-reduce -loop-reroll -loop-rotate -loop-unroll -loop-unswitch -S -debug %s 2>&1 | FileCheck %s --check-prefix=OPT-LOOP |
Paul Robinson | 2684ddd | 2014-02-06 00:07:05 +0000 | [diff] [blame] | 7 | |
| 8 | ; REQUIRES: asserts |
| 9 | |
| 10 | ; This test verifies that we don't run target independent IR-level |
| 11 | ; optimizations on optnone functions. |
| 12 | |
| 13 | ; Function Attrs: noinline optnone |
| 14 | define i32 @_Z3fooi(i32 %x) #0 { |
| 15 | entry: |
| 16 | %x.addr = alloca i32, align 4 |
| 17 | store i32 %x, i32* %x.addr, align 4 |
| 18 | br label %while.cond |
| 19 | |
| 20 | while.cond: ; preds = %while.body, %entry |
David Blaikie | 7c9c6ed | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 21 | %0 = load i32, i32* %x.addr, align 4 |
Paul Robinson | 2684ddd | 2014-02-06 00:07:05 +0000 | [diff] [blame] | 22 | %dec = add nsw i32 %0, -1 |
| 23 | store i32 %dec, i32* %x.addr, align 4 |
| 24 | %tobool = icmp ne i32 %0, 0 |
| 25 | br i1 %tobool, label %while.body, label %while.end |
| 26 | |
| 27 | while.body: ; preds = %while.cond |
| 28 | br label %while.cond |
| 29 | |
| 30 | while.end: ; preds = %while.cond |
| 31 | ret i32 0 |
| 32 | } |
| 33 | |
| 34 | attributes #0 = { optnone noinline } |
| 35 | |
| 36 | ; Nothing that runs at -O0 gets skipped. |
| 37 | ; OPT-O0-NOT: Skipping pass |
| 38 | |
| 39 | ; IR passes run at -O1 and higher. |
| 40 | ; OPT-O1-DAG: Skipping pass 'Aggressive Dead Code Elimination' |
| 41 | ; OPT-O1-DAG: Skipping pass 'Combine redundant instructions' |
| 42 | ; OPT-O1-DAG: Skipping pass 'Dead Store Elimination' |
| 43 | ; OPT-O1-DAG: Skipping pass 'Early CSE' |
Paul Robinson | 2684ddd | 2014-02-06 00:07:05 +0000 | [diff] [blame] | 44 | ; OPT-O1-DAG: Skipping pass 'Jump Threading' |
| 45 | ; OPT-O1-DAG: Skipping pass 'MemCpy Optimization' |
| 46 | ; OPT-O1-DAG: Skipping pass 'Reassociate expressions' |
| 47 | ; OPT-O1-DAG: Skipping pass 'Simplify the CFG' |
| 48 | ; OPT-O1-DAG: Skipping pass 'Sparse Conditional Constant Propagation' |
| 49 | ; OPT-O1-DAG: Skipping pass 'SROA' |
| 50 | ; OPT-O1-DAG: Skipping pass 'Tail Call Elimination' |
| 51 | ; OPT-O1-DAG: Skipping pass 'Value Propagation' |
| 52 | |
| 53 | ; Additional IR passes run at -O2 and higher. |
| 54 | ; OPT-O2O3-DAG: Skipping pass 'Global Value Numbering' |
| 55 | ; OPT-O2O3-DAG: Skipping pass 'SLP Vectorizer' |
| 56 | |
| 57 | ; Additional IR passes that opt doesn't turn on by default. |
Paul Robinson | 2684ddd | 2014-02-06 00:07:05 +0000 | [diff] [blame] | 58 | ; OPT-MORE-DAG: Skipping pass 'Dead Code Elimination' |
| 59 | ; OPT-MORE-DAG: Skipping pass 'Dead Instruction Elimination' |
Paul Robinson | 2684ddd | 2014-02-06 00:07:05 +0000 | [diff] [blame] | 60 | |
| 61 | ; Loop IR passes that opt doesn't turn on by default. |
| 62 | ; OPT-LOOP-DAG: Skipping pass 'Delete dead loops' |
| 63 | ; OPT-LOOP-DAG: Skipping pass 'Extract loops into new functions' |
| 64 | ; OPT-LOOP-DAG: Skipping pass 'Induction Variable Simplification' |
| 65 | ; OPT-LOOP-DAG: Skipping pass 'Loop Invariant Code Motion' |
| 66 | ; OPT-LOOP-DAG: Skipping pass 'Loop Strength Reduction' |
| 67 | ; OPT-LOOP-DAG: Skipping pass 'Recognize loop idioms' |
| 68 | ; OPT-LOOP-DAG: Skipping pass 'Reroll loops' |
| 69 | ; OPT-LOOP-DAG: Skipping pass 'Rotate Loops' |
Chandler Carruth | 7781850 | 2018-05-25 01:32:36 +0000 | [diff] [blame] | 70 | ; OPT-LOOP-DAG: Skipping pass 'Simplify instructions in loops' |
Paul Robinson | 2684ddd | 2014-02-06 00:07:05 +0000 | [diff] [blame] | 71 | ; OPT-LOOP-DAG: Skipping pass 'Unroll loops' |
| 72 | ; OPT-LOOP-DAG: Skipping pass 'Unswitch loops' |