1; RUN: opt -passes='default<O0>' -S -debug-pass-manager %s 2>&1 | FileCheck %s --check-prefix=%llvmcheckext-NPM-O0 2; RUN: opt -passes='default<O1>' -S -debug-pass-manager %s 2>&1 | FileCheck %s --check-prefix=NPM-O1 3; RUN: opt -passes='default<O2>' -S -debug-pass-manager %s 2>&1 | FileCheck %s --check-prefix=NPM-O1 --check-prefix=NPM-O2O3 4; RUN: opt -passes='default<O3>' -S -debug-pass-manager %s 2>&1 | FileCheck %s --check-prefix=NPM-O1 --check-prefix=NPM-O2O3 5; RUN: opt -passes='dce,gvn-hoist,lower-atomic' -S -debug-pass-manager %s 2>&1 | FileCheck %s --check-prefix=NPM-MORE 6; RUN: opt -passes='loop(indvars,licm,loop-deletion,loop-idiom,loop-instsimplify,loop-reduce,simple-loop-unswitch),loop-unroll' -S -debug-pass-manager %s 2>&1 | FileCheck %s --check-prefix=NPM-LOOP 7; RUN: opt -passes='instsimplify,verify' -S -debug-pass-manager %s 2>&1 | FileCheck %s --check-prefix=NPM-REQUIRED 8 9; This test verifies that we don't run target independent IR-level 10; optimizations on optnone functions. 11 12; Function Attrs: noinline optnone 13define i32 @foo(i32 %x) #0 { 14entry: 15 %x.addr = alloca i32, align 4 16 store i32 %x, ptr %x.addr, align 4 17 br label %while.cond 18 19while.cond: ; preds = %while.body, %entry 20 %0 = load i32, ptr %x.addr, align 4 21 %dec = add nsw i32 %0, -1 22 store i32 %dec, ptr %x.addr, align 4 23 %tobool = icmp ne i32 %0, 0 24 br i1 %tobool, label %while.body, label %while.end 25 26while.body: ; preds = %while.cond 27 br label %while.cond 28 29while.end: ; preds = %while.cond 30 ret i32 %dec 31} 32 33attributes #0 = { optnone noinline } 34 35; Nothing that runs at -O0 gets skipped (except when the Bye extension is present). 36; CHECK-EXT-NPM-O0: Skipping pass {{.*}}Bye 37; CHECK-NOEXT-NPM-O0-NOT: Skipping pass 38 39; IR passes run at -O1 and higher. 40; NPM-O1-DAG: Skipping pass: SimplifyCFGPass on foo 41; NPM-O1-DAG: Skipping pass: SROA 42; NPM-O1-DAG: Skipping pass: EarlyCSEPass 43; NPM-O1-DAG: Skipping pass: LowerExpectIntrinsicPass 44; NPM-O1-DAG: Skipping pass: InstCombinePass 45 46; Additional IR passes run at -O2 and higher. 47; NPM-O2O3-DAG: Skipping pass: GVN 48; NPM-O2O3-DAG: Skipping pass: SLPVectorizerPass 49 50; Additional IR passes that opt doesn't turn on by default. 51; NPM-MORE-DAG: Skipping pass: DCEPass 52; NPM-MORE-DAG: Skipping pass: GVNHoistPass 53 54; Loop IR passes that opt doesn't turn on by default. 55; LoopPassManager should not be skipped over an optnone function 56; NPM-LOOP-NOT: Skipping pass: PassManager 57; NPM-LOOP-DAG: Skipping pass: LoopSimplifyPass on foo 58; NPM-LOOP-DAG: Skipping pass: LCSSAPass 59; NPM-LOOP-DAG: Skipping pass: IndVarSimplifyPass 60; NPM-LOOP-DAG: Skipping pass: SimpleLoopUnswitchPass 61; NPM-LOOP-DAG: Skipping pass: LoopUnrollPass 62; NPM-LOOP-DAG: Skipping pass: LoopStrengthReducePass 63; NPM-LOOP-DAG: Skipping pass: LoopDeletionPass 64; NPM-LOOP-DAG: Skipping pass: LICMPass 65; NPM-LOOP-DAG: Skipping pass: LoopIdiomRecognizePass 66; NPM-LOOP-DAG: Skipping pass: LoopInstSimplifyPass 67 68; NPM-REQUIRED-DAG: Skipping pass: InstSimplifyPass 69; NPM-REQUIRED-DAG: Skipping pass InstSimplifyPass on foo due to optnone attribute 70; NPM-REQUIRED-DAG: Running pass: VerifierPass 71; NPM-REQUIRED-NOT: Skipping pass: VerifyPass 72; NPM-REQUIRED-NOT: Skipping pass VerifyPass on foo due to optnone attribute 73