1; Test that all coroutine passes run in the correct order at all optimization
2; levels and -enable-coroutines adds coroutine passes to the pipeline.
3;
4; Legacy pass manager:
5; RUN: opt < %s -disable-output -enable-coroutines -debug-pass=Arguments -O0 -enable-new-pm=0 2>&1 | FileCheck %s
6; RUN: opt < %s -disable-output -enable-coroutines -debug-pass=Arguments -O1 -enable-new-pm=0 2>&1 | FileCheck %s
7; RUN: opt < %s -disable-output -enable-coroutines -debug-pass=Arguments -O2 -enable-new-pm=0 2>&1 | FileCheck %s
8; RUN: opt < %s -disable-output -enable-coroutines -debug-pass=Arguments -O3 -enable-new-pm=0 2>&1 | FileCheck %s
9; RUN: opt < %s -disable-output -enable-coroutines -debug-pass=Arguments \
10; RUN:     -coro-early -coro-split -coro-elide -coro-cleanup -enable-new-pm=0 2>&1 | FileCheck %s
11; RUN: opt < %s -disable-output -debug-pass=Arguments -enable-new-pm=0 2>&1 \
12; RUN:     | FileCheck %s -check-prefix=NOCORO
13; New pass manager:
14; RUN: opt < %s -disable-output -passes='default<O0>' -enable-coroutines \
15; RUN:     -debug-pass-manager 2>&1 | FileCheck %s -check-prefix=NEWPM
16; RUN: opt < %s -disable-output -passes='default<O1>' -enable-coroutines \
17; RUN:     -debug-pass-manager 2>&1 | FileCheck %s -check-prefix=NEWPM
18; RUN: opt < %s -disable-output -passes='default<O2>' -enable-coroutines \
19; RUN:     -debug-pass-manager 2>&1 | FileCheck %s -check-prefix=NEWPM
20; RUN: opt < %s -disable-output -passes='default<O3>' -enable-coroutines \
21; RUN:     -debug-pass-manager 2>&1 | FileCheck %s -check-prefix=NEWPM
22; RUN: opt < %s -disable-output -debug-pass-manager \
23; RUN:     -passes='function(coro-early),cgscc(coro-split),function(coro-elide,coro-cleanup)' 2>&1 \
24; RUN:     | FileCheck %s -check-prefix=NEWPM
25
26; CHECK: coro-early
27; CHECK: coro-split
28; CHECK: coro-elide
29; CHECK: coro-cleanup
30
31; NOCORO-NOT: coro-early
32; NOCORO-NOT: coro-split
33; NOCORO-NOT: coro-elide
34; NOCORO-NOT: coro-cleanup
35
36; NEWPM: CoroEarlyPass
37; NEWPM: CoroSplitPass
38; NEWPM: CoroElidePass
39; NEWPM: CoroCleanupPass
40
41define void @foo() {
42  ret void
43}
44