1 ; Verifies that LICM is disabled for loops that contains coro.suspend.
2 ; RUN: opt -S < %s -passes=licm | FileCheck %s
4 define i64 @licm(i64 %n) #0 {
7 ; CHECK-NEXT: [[P:%.*]] = alloca i64, align 8
8 ; CHECK-NEXT: br label [[BB0:%.*]]
10 ; CHECK-NEXT: br label [[LOOP:%.*]]
12 ; CHECK-NEXT: [[I:%.*]] = phi i64 [ 0, [[BB0]] ], [ [[T5:%.*]], [[AWAIT_READY:%.*]] ]
13 ; CHECK-NEXT: [[T5]] = add i64 [[I]], 1
14 ; CHECK-NEXT: [[SUSPEND:%.*]] = call i8 @llvm.coro.suspend(token none, i1 false)
15 ; CHECK-NEXT: switch i8 [[SUSPEND]], label [[BB2:%.*]] [
16 ; CHECK-NEXT: i8 0, label [[AWAIT_READY]]
19 ; CHECK-NEXT: store i64 1, i64* [[P]], align 4
20 ; CHECK-NEXT: [[T6:%.*]] = icmp ult i64 [[T5]], [[N:%.*]]
21 ; CHECK-NEXT: br i1 [[T6]], label [[LOOP]], label [[BB2]]
23 ; CHECK-NEXT: [[RES:%.*]] = call i1 @llvm.coro.end(i8* null, i1 false)
24 ; CHECK-NEXT: ret i64 0
34 %i = phi i64 [ 0, %bb0 ], [ %t5, %await.ready ]
36 %suspend = call i8 @llvm.coro.suspend(token none, i1 false)
37 switch i8 %suspend, label %bb2 [
38 i8 0, label %await.ready
43 %t6 = icmp ult i64 %t5, %n
44 br i1 %t6, label %loop, label %bb2
47 %res = call i1 @llvm.coro.end(i8* null, i1 false)
51 declare i8 @llvm.coro.suspend(token, i1)
52 declare i1 @llvm.coro.end(i8*, i1)