1; Verifies that the restart trigger that is used by legacy coroutine passes 2; forces the legacy pass manager to restart IPO pipelines, thereby causing the 3; same coroutine to be looked at by CoroSplit pass twice. 4; REQUIRES: asserts 5; RUN: opt < %s -S -O0 -enable-coroutines -debug-only=coro-split 2>&1 | FileCheck %s 6; RUN: opt < %s -S -O1 -enable-coroutines -debug-only=coro-split 2>&1 | FileCheck %s 7; The following tests use the new pass manager, and verify that the coroutine 8; passes re-run the CGSCC pipeline. 9; RUN: opt < %s -S -passes='default<O0>' -enable-coroutines -debug-only=coro-split 2>&1 | FileCheck %s 10; RUN: opt < %s -S -passes='default<O1>' -enable-coroutines -debug-only=coro-split 2>&1 | FileCheck %s 11 12; CHECK: CoroSplit: Processing coroutine 'f' state: 0 13; CHECK-NEXT: CoroSplit: Processing coroutine 'f' state: 1 14 15define void @f() { 16 %id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null) 17 %size = call i32 @llvm.coro.size.i32() 18 %alloc = call i8* @malloc(i32 %size) 19 %hdl = call i8* @llvm.coro.begin(token %id, i8* %alloc) 20 call void @print(i32 0) 21 %s1 = call i8 @llvm.coro.suspend(token none, i1 false) 22 switch i8 %s1, label %suspend [i8 0, label %resume 23 i8 1, label %cleanup] 24resume: 25 call void @print(i32 1) 26 br label %cleanup 27 28cleanup: 29 %mem = call i8* @llvm.coro.free(token %id, i8* %hdl) 30 call void @free(i8* %mem) 31 br label %suspend 32suspend: 33 call i1 @llvm.coro.end(i8* %hdl, i1 0) 34 ret void 35} 36 37declare token @llvm.coro.id(i32, i8*, i8*, i8*) 38declare i8* @llvm.coro.begin(token, i8*) 39declare i8* @llvm.coro.free(token, i8*) 40declare i32 @llvm.coro.size.i32() 41declare i8 @llvm.coro.suspend(token, i1) 42declare void @llvm.coro.resume(i8*) 43declare void @llvm.coro.destroy(i8*) 44declare i1 @llvm.coro.end(i8*, i1) 45 46declare noalias i8* @malloc(i32) 47declare void @print(i32) 48declare void @free(i8*) 49