1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 2; RUN: opt -S < %s -loop-unroll | FileCheck %s 3; RUN: opt -S < %s -passes=loop-unroll | FileCheck %s 4target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128-ni:1-p2:32:8:8:32-ni:2" 5target triple = "x86_64-unknown-linux-gnu" 6 7define i32 @test() { 8; CHECK-LABEL: @test( 9; CHECK-NEXT: bb: 10; CHECK-NEXT: br label [[BB1:%.*]] 11; CHECK: bb1: 12; CHECK-NEXT: [[TMP:%.*]] = phi i32 [ -147, [[BB:%.*]] ], [ [[TMP14:%.*]], [[BB13:%.*]] ] 13; CHECK-NEXT: br label [[BB2_PEEL_BEGIN:%.*]] 14; CHECK: bb2.peel.begin: 15; CHECK-NEXT: br label [[BB2_PEEL:%.*]] 16; CHECK: bb2.peel: 17; CHECK-NEXT: [[TMP4_PEEL:%.*]] = add nsw i32 undef, [[TMP]] 18; CHECK-NEXT: br label [[BB5_PEEL:%.*]] 19; CHECK: bb5.peel: 20; CHECK-NEXT: [[TMP6_PEEL:%.*]] = icmp eq i32 undef, 33 21; CHECK-NEXT: br i1 [[TMP6_PEEL]], label [[BB7_PEEL:%.*]], label [[BB15_LOOPEXIT2:%.*]] 22; CHECK: bb7.peel: 23; CHECK-NEXT: [[TMP8_PEEL:%.*]] = sub nsw i32 undef, undef 24; CHECK-NEXT: [[TMP9_PEEL:%.*]] = icmp eq i32 [[TMP8_PEEL]], 0 25; CHECK-NEXT: br i1 [[TMP9_PEEL]], label [[BB10_PEEL:%.*]], label [[BB10_PEEL]] 26; CHECK: bb10.peel: 27; CHECK-NEXT: [[TMP11_PEEL:%.*]] = icmp eq i8 undef, 0 28; CHECK-NEXT: br i1 [[TMP11_PEEL]], label [[BB12_PEEL:%.*]], label [[BB17_LOOPEXIT3:%.*]] 29; CHECK: bb12.peel: 30; CHECK-NEXT: br i1 false, label [[BB13]], label [[BB2_PEEL_NEXT:%.*]] 31; CHECK: bb2.peel.next: 32; CHECK-NEXT: br label [[BB2_PEEL_NEXT1:%.*]] 33; CHECK: bb2.peel.next1: 34; CHECK-NEXT: br label [[BB1_PEEL_NEWPH:%.*]] 35; CHECK: bb1.peel.newph: 36; CHECK-NEXT: br label [[BB2:%.*]] 37; CHECK: bb2: 38; CHECK-NEXT: [[TMP3:%.*]] = phi i32 [ [[TMP4_PEEL]], [[BB1_PEEL_NEWPH]] ], [ [[TMP4:%.*]], [[BB12:%.*]] ] 39; CHECK-NEXT: [[TMP4]] = add nsw i32 [[TMP3]], [[TMP]] 40; CHECK-NEXT: br label [[BB5:%.*]] 41; CHECK: bb5: 42; CHECK-NEXT: br i1 false, label [[BB7:%.*]], label [[BB15_LOOPEXIT:%.*]] 43; CHECK: bb7: 44; CHECK-NEXT: br i1 undef, label [[BB10:%.*]], label [[BB10]] 45; CHECK: bb10: 46; CHECK-NEXT: br i1 false, label [[BB12]], label [[BB17_LOOPEXIT:%.*]] 47; CHECK: bb12: 48; CHECK-NEXT: br i1 false, label [[BB13_LOOPEXIT:%.*]], label [[BB2]], !llvm.loop !0 49; CHECK: bb13.loopexit: 50; CHECK-NEXT: br label [[BB13]] 51; CHECK: bb13: 52; CHECK-NEXT: [[TMP14]] = add nsw i32 [[TMP]], -1 53; CHECK-NEXT: br label [[BB1]] 54; CHECK: bb15.loopexit: 55; CHECK-NEXT: br label [[BB15:%.*]] 56; CHECK: bb15.loopexit2: 57; CHECK-NEXT: br label [[BB15]] 58; CHECK: bb15: 59; CHECK-NEXT: [[TMP16:%.*]] = call i32 (...) @llvm.experimental.deoptimize.i32(i32 17) [ "deopt"() ] 60; CHECK-NEXT: ret i32 [[TMP16]] 61; CHECK: bb17.loopexit: 62; CHECK-NEXT: br label [[BB17:%.*]] 63; CHECK: bb17.loopexit3: 64; CHECK-NEXT: br label [[BB17]] 65; CHECK: bb17: 66; CHECK-NEXT: [[TMP18:%.*]] = call i32 (...) @llvm.experimental.deoptimize.i32(i32 6) [ "deopt"() ] 67; CHECK-NEXT: ret i32 [[TMP18]] 68; 69bb: 70 br label %bb1 71 72bb1: ; preds = %bb13, %bb 73 %tmp = phi i32 [ -147, %bb ], [ %tmp14, %bb13 ] 74 br label %bb2 75 76bb2: ; preds = %bb12, %bb1 77 %tmp3 = phi i32 [ undef, %bb1 ], [ %tmp4, %bb12 ] 78 %tmp4 = add nsw i32 %tmp3, %tmp 79 br label %bb5 80 81bb5: ; preds = %bb2 82 %tmp6 = icmp eq i32 undef, 33 83 br i1 %tmp6, label %bb7, label %bb15 84 85bb7: ; preds = %bb5 86 %tmp8 = sub nsw i32 %tmp3, undef 87 %tmp9 = icmp eq i32 %tmp8, 0 88 br i1 %tmp9, label %bb10, label %bb10 89 90bb10: ; preds = %bb7, %bb7 91 %tmp11 = icmp eq i8 undef, 0 92 br i1 %tmp11, label %bb12, label %bb17 93 94bb12: ; preds = %bb10 95 br i1 false, label %bb13, label %bb2 96 97bb13: ; preds = %bb12 98 %tmp14 = add nsw i32 %tmp, -1 99 br label %bb1 100 101bb15: ; preds = %bb5 102 %tmp16 = call i32 (...) @llvm.experimental.deoptimize.i32(i32 17) [ "deopt"() ] 103 ret i32 %tmp16 104 105bb17: ; preds = %bb10 106 %tmp18 = call i32 (...) @llvm.experimental.deoptimize.i32(i32 6) [ "deopt"() ] 107 ret i32 %tmp18 108} 109 110declare i32 @llvm.experimental.deoptimize.i32(...) 111