1; RUN: opt < %s -passes='default<O1>' -disable-output -debug-pass-manager=verbose -enable-no-rerun-simplification-pipeline=0 2>&1 | FileCheck %s --check-prefixes=CHECK,RERUNSP
2; RUN: opt < %s -passes='default<O2>' -disable-output -debug-pass-manager=verbose -enable-no-rerun-simplification-pipeline=0 2>&1 | FileCheck %s --check-prefixes=CHECK,RERUNSP
3; RUN: opt < %s -passes='default<O1>' -disable-output -debug-pass-manager=verbose -enable-no-rerun-simplification-pipeline=1 2>&1 | FileCheck %s --check-prefixes=CHECK,NORERUN
4; RUN: opt < %s -passes='default<O2>' -disable-output -debug-pass-manager=verbose -enable-no-rerun-simplification-pipeline=1 2>&1 | FileCheck %s --check-prefixes=CHECK,NORERUN
5
6; BDCE only runs once in the function simplification pipeline and nowhere else so we use that to check for reruns.
7
8; CHECK: PassManager{{.*}}SCC{{.*}} on (f1)
9; CHECK: Running pass: BDCEPass on f1
10; CHECK: PassManager{{.*}}SCC{{.*}} on (f2, f3)
11; CHECK: Running pass: BDCEPass on f2
12; CHECK-NOT: BDCEPass
13; CHECK: PassManager{{.*}}SCC{{.*}} on (f2)
14; RERUNSP: Running pass: BDCEPass on f2
15; NORERUN-NOT: Running pass: BDCEPass on f2
16; CHECK: PassManager{{.*}}SCC{{.*}} on (f3)
17; CHECK: Running pass: BDCEPass on f3
18
19define void @f1(void()* %p) alwaysinline {
20  call void %p()
21  ret void
22}
23
24define void @f2() #0 {
25  call void @f1(void()* @f2)
26  call void @f3()
27  ret void
28}
29
30define void @f3() #0 {
31  call void @f2()
32  ret void
33}
34
35attributes #0 = { nofree noreturn nosync nounwind readnone noinline }
36