1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -S -passes=loop-unroll -unroll-peel-count=1 < %s | FileCheck %s
4 declare zeroext i8 @patatino()
6 define fastcc void @tinky() {
9 ; CHECK-NEXT: br label [[NEXT:%.*]]
10 ; CHECK: loopexit.loopexit:
11 ; CHECK-NEXT: br label [[LOOPEXIT:%.*]]
13 ; CHECK-NEXT: ret void
15 ; CHECK-NEXT: br label [[LOOP_PEEL_BEGIN:%.*]]
16 ; CHECK: loop.peel.begin:
17 ; CHECK-NEXT: br label [[LOOP_PEEL:%.*]]
19 ; CHECK-NEXT: [[CALL593_PEEL:%.*]] = tail call zeroext i8 @patatino()
20 ; CHECK-NEXT: br i1 false, label [[LOOP_PEEL_NEXT:%.*]], label [[LOOPEXIT]]
21 ; CHECK: loop.peel.next:
22 ; CHECK-NEXT: br label [[LOOP_PEEL_NEXT1:%.*]]
23 ; CHECK: loop.peel.next1:
24 ; CHECK-NEXT: br label [[NEXT_PEEL_NEWPH:%.*]]
25 ; CHECK: next.peel.newph:
26 ; CHECK-NEXT: br label [[LOOP:%.*]]
28 ; CHECK-NEXT: [[CALL593:%.*]] = tail call zeroext i8 @patatino()
29 ; CHECK-NEXT: br i1 false, label [[LOOP]], label [[LOOPEXIT_LOOPEXIT:%.*]], !llvm.loop [[LOOP0:![0-9]+]]
41 %a = phi i8 [ undef, %next ], [ %call593, %loop ]
42 %b = phi i32 [ 0, %next ], [ 1, %loop ]
43 %call593 = tail call zeroext i8 @patatino()
44 br i1 false, label %loop, label %loopexit
47 define void @tinky2() {
48 ; CHECK-LABEL: @tinky2(
50 ; CHECK-NEXT: br label [[NEXT:%.*]]
51 ; CHECK: loopexit.loopexit:
52 ; CHECK-NEXT: br label [[LOOPEXIT:%.*]]
54 ; CHECK-NEXT: ret void
56 ; CHECK-NEXT: br label [[LOOP_PEEL_BEGIN:%.*]]
57 ; CHECK: loop.peel.begin:
58 ; CHECK-NEXT: br label [[LOOP_PEEL:%.*]]
60 ; CHECK-NEXT: [[CALL593_PEEL:%.*]] = tail call zeroext i8 @patatino()
61 ; CHECK-NEXT: [[B_NEXT_PEEL:%.*]] = add i32 0, 1
62 ; CHECK-NEXT: [[COND_PEEL:%.*]] = icmp ne i32 0, 30
63 ; CHECK-NEXT: br i1 [[COND_PEEL]], label [[LOOP_PEEL_NEXT:%.*]], label [[LOOPEXIT]]
64 ; CHECK: loop.peel.next:
65 ; CHECK-NEXT: br label [[LOOP_PEEL_NEXT1:%.*]]
66 ; CHECK: loop.peel.next1:
67 ; CHECK-NEXT: br label [[NEXT_PEEL_NEWPH:%.*]]
68 ; CHECK: next.peel.newph:
69 ; CHECK-NEXT: br label [[LOOP:%.*]]
71 ; CHECK-NEXT: [[B:%.*]] = phi i32 [ [[B_NEXT_PEEL]], [[NEXT_PEEL_NEWPH]] ], [ [[B_NEXT:%.*]], [[LOOP]] ]
72 ; CHECK-NEXT: [[CALL593:%.*]] = tail call zeroext i8 @patatino()
73 ; CHECK-NEXT: [[B_NEXT]] = add nuw nsw i32 [[B]], 1
74 ; CHECK-NEXT: [[COND:%.*]] = icmp ne i32 [[B]], 30
75 ; CHECK-NEXT: br i1 [[COND]], label [[LOOP]], label [[LOOPEXIT_LOOPEXIT:%.*]], !llvm.loop [[LOOP3:![0-9]+]]
87 %a = phi i8 [ undef, %next ], [ %call593, %loop ]
88 %b = phi i32 [ 0, %next ], [ %b.next, %loop ]
89 %call593 = tail call zeroext i8 @patatino()
90 %b.next = add i32 %b, 1
91 %cond = icmp ne i32 %b, 30
92 br i1 %cond, label %loop, label %loopexit