1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -passes='simplifycfg<hoist-common-insts>' -S | FileCheck %s
4 declare token @llvm.coro.save(ptr) #0
5 declare i8 @llvm.coro.suspend(token, i1)
7 define void @final_nonfinal_suspend(i32 %x) {
8 ; CHECK-LABEL: @final_nonfinal_suspend(
10 ; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[X:%.*]], 0
11 ; CHECK-NEXT: br i1 [[CMP]], label [[AWAIT_SUSPEND:%.*]], label [[FINAL_SUSPEND:%.*]]
12 ; CHECK: await.suspend:
13 ; CHECK-NEXT: [[TMP0:%.*]] = call token @llvm.coro.save(ptr null)
14 ; CHECK-NEXT: [[TMP1:%.*]] = call i8 @llvm.coro.suspend(token [[TMP0]], i1 false)
15 ; CHECK-NEXT: br label [[CORO_RET:%.*]]
16 ; CHECK: final.suspend:
17 ; CHECK-NEXT: [[TMP2:%.*]] = call token @llvm.coro.save(ptr null)
18 ; CHECK-NEXT: [[TMP3:%.*]] = call i8 @llvm.coro.suspend(token [[TMP2]], i1 true)
19 ; CHECK-NEXT: br label [[CORO_RET]]
21 ; CHECK-NEXT: ret void
24 %cmp = icmp slt i32 %x, 0
25 br i1 %cmp, label %await.suspend, label %final.suspend
28 %0 = call token @llvm.coro.save(ptr null)
29 %1 = call i8 @llvm.coro.suspend(token %0, i1 false)
33 %2 = call token @llvm.coro.save(ptr null)
34 %3 = call i8 @llvm.coro.suspend(token %2, i1 true)
41 define void @both_nonfinal_suspend(i32 %x) {
42 ; CHECK-LABEL: @both_nonfinal_suspend(
44 ; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[X:%.*]], 0
45 ; CHECK-NEXT: br i1 [[CMP]], label [[AWAIT_SUSPEND:%.*]], label [[FINAL_SUSPEND:%.*]]
46 ; CHECK: await.suspend:
47 ; CHECK-NEXT: [[TMP0:%.*]] = call token @llvm.coro.save(ptr null)
48 ; CHECK-NEXT: [[TMP1:%.*]] = call i8 @llvm.coro.suspend(token [[TMP0]], i1 false)
49 ; CHECK-NEXT: br label [[CORO_RET:%.*]]
50 ; CHECK: final.suspend:
51 ; CHECK-NEXT: [[TMP2:%.*]] = call token @llvm.coro.save(ptr null)
52 ; CHECK-NEXT: [[TMP3:%.*]] = call i8 @llvm.coro.suspend(token [[TMP2]], i1 false)
53 ; CHECK-NEXT: br label [[CORO_RET]]
55 ; CHECK-NEXT: ret void
58 %cmp = icmp slt i32 %x, 0
59 br i1 %cmp, label %await.suspend, label %final.suspend
62 %0 = call token @llvm.coro.save(ptr null)
63 %1 = call i8 @llvm.coro.suspend(token %0, i1 false)
67 %2 = call token @llvm.coro.save(ptr null)
68 %3 = call i8 @llvm.coro.suspend(token %2, i1 false)
75 attributes #0 = { nomerge }