1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 2; RUN: opt -S -loop-unroll -unroll-count=4 -unroll-peel-count=1 < %s | FileCheck %s 3 4declare zeroext i8 @patatino() 5 6define fastcc void @tinky() { 7; CHECK-LABEL: @tinky( 8; CHECK-NEXT: entry: 9; CHECK-NEXT: br label [[NEXT:%.*]] 10; CHECK: loopexit: 11; CHECK-NEXT: ret void 12; CHECK: next: 13; CHECK-NEXT: br label [[LOOP_PEEL_BEGIN:%.*]] 14; CHECK: loop.peel.begin: 15; CHECK-NEXT: br label [[LOOP_PEEL:%.*]] 16; CHECK: loop.peel: 17; CHECK-NEXT: [[CALL593_PEEL:%.*]] = tail call zeroext i8 @patatino() 18; CHECK-NEXT: br i1 false, label [[LOOP_PEEL_NEXT:%.*]], label [[LOOPEXIT:%.*]] 19; CHECK: loop.peel.next: 20; CHECK-NEXT: br label [[LOOP_PEEL_NEXT1:%.*]] 21; CHECK: loop.peel.next1: 22; CHECK-NEXT: br label [[NEXT_PEEL_NEWPH:%.*]] 23; CHECK: next.peel.newph: 24; CHECK-NEXT: br label [[LOOP:%.*]] 25; CHECK: loop: 26; CHECK-NEXT: [[CALL593:%.*]] = tail call zeroext i8 @patatino() 27; CHECK-NEXT: br label [[LOOPEXIT]] 28; 29entry: 30 br label %next 31 32loopexit: 33 ret void 34 35next: 36 br label %loop 37 38loop: 39 %a = phi i8 [ undef, %next ], [ %call593, %loop ] 40 %b = phi i32 [ 0, %next ], [ 1, %loop ] 41 %call593 = tail call zeroext i8 @patatino() 42 br i1 false, label %loop, label %loopexit 43} 44 45define void @tinky2() { 46; CHECK-LABEL: @tinky2( 47; CHECK-NEXT: entry: 48; CHECK-NEXT: br label [[NEXT:%.*]] 49; CHECK: loopexit.loopexit: 50; CHECK-NEXT: br label [[LOOPEXIT:%.*]] 51; CHECK: loopexit: 52; CHECK-NEXT: ret void 53; CHECK: next: 54; CHECK-NEXT: br label [[LOOP_PEEL_BEGIN:%.*]] 55; CHECK: loop.peel.begin: 56; CHECK-NEXT: br label [[LOOP_PEEL:%.*]] 57; CHECK: loop.peel: 58; CHECK-NEXT: [[CALL593_PEEL:%.*]] = tail call zeroext i8 @patatino() 59; CHECK-NEXT: [[B_NEXT_PEEL:%.*]] = add i32 0, 1 60; CHECK-NEXT: [[COND_PEEL:%.*]] = icmp ne i32 0, 30 61; CHECK-NEXT: br i1 [[COND_PEEL]], label [[LOOP_PEEL_NEXT:%.*]], label [[LOOPEXIT]] 62; CHECK: loop.peel.next: 63; CHECK-NEXT: br label [[LOOP_PEEL_NEXT1:%.*]] 64; CHECK: loop.peel.next1: 65; CHECK-NEXT: br label [[NEXT_PEEL_NEWPH:%.*]] 66; CHECK: next.peel.newph: 67; CHECK-NEXT: br label [[LOOP:%.*]] 68; CHECK: loop: 69; CHECK-NEXT: [[B:%.*]] = phi i32 [ [[B_NEXT_PEEL]], [[NEXT_PEEL_NEWPH]] ], [ [[B_NEXT_3:%.*]], [[LOOP_2:%.*]] ] 70; CHECK-NEXT: [[CALL593:%.*]] = tail call zeroext i8 @patatino() 71; CHECK-NEXT: [[B_NEXT:%.*]] = add nuw nsw i32 [[B]], 1 72; CHECK-NEXT: [[CALL593_1:%.*]] = tail call zeroext i8 @patatino() 73; CHECK-NEXT: [[B_NEXT_1:%.*]] = add nuw nsw i32 [[B_NEXT]], 1 74; CHECK-NEXT: [[COND_1:%.*]] = icmp ne i32 [[B_NEXT]], 30 75; CHECK-NEXT: br i1 [[COND_1]], label [[LOOP_2]], label [[LOOPEXIT_LOOPEXIT:%.*]], !llvm.loop !0 76; CHECK: loop.2: 77; CHECK-NEXT: [[CALL593_2:%.*]] = tail call zeroext i8 @patatino() 78; CHECK-NEXT: [[B_NEXT_2:%.*]] = add nuw nsw i32 [[B_NEXT_1]], 1 79; CHECK-NEXT: [[CALL593_3:%.*]] = tail call zeroext i8 @patatino() 80; CHECK-NEXT: [[B_NEXT_3]] = add nuw nsw i32 [[B_NEXT_2]], 1 81; CHECK-NEXT: br label [[LOOP]], !llvm.loop !2 82; 83entry: 84 br label %next 85 86loopexit: 87 ret void 88 89next: 90 br label %loop 91 92loop: 93 %a = phi i8 [ undef, %next ], [ %call593, %loop ] 94 %b = phi i32 [ 0, %next ], [ %b.next, %loop ] 95 %call593 = tail call zeroext i8 @patatino() 96 %b.next = add i32 %b, 1 97 %cond = icmp ne i32 %b, 30 98 br i1 %cond, label %loop, label %loopexit 99} 100