1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -S < %s -passes=loop-unroll | FileCheck %s
3 target 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"
4 target triple = "x86_64-unknown-linux-gnu"
9 ; CHECK-NEXT: br label [[BB1:%.*]]
11 ; CHECK-NEXT: [[TMP:%.*]] = phi i32 [ -147, [[BB:%.*]] ], [ [[TMP14:%.*]], [[BB13:%.*]] ]
12 ; CHECK-NEXT: br label [[BB2_PEEL_BEGIN:%.*]]
13 ; CHECK: bb2.peel.begin:
14 ; CHECK-NEXT: br label [[BB2_PEEL:%.*]]
16 ; CHECK-NEXT: [[TMP4_PEEL:%.*]] = add nsw i32 undef, [[TMP]]
17 ; CHECK-NEXT: br label [[BB5_PEEL:%.*]]
19 ; CHECK-NEXT: [[TMP6_PEEL:%.*]] = icmp eq i32 undef, 33
20 ; CHECK-NEXT: br i1 [[TMP6_PEEL]], label [[BB7_PEEL:%.*]], label [[BB15_LOOPEXIT2:%.*]]
22 ; CHECK-NEXT: [[TMP8_PEEL:%.*]] = sub nsw i32 undef, undef
23 ; CHECK-NEXT: [[TMP9_PEEL:%.*]] = icmp eq i32 [[TMP8_PEEL]], 0
24 ; CHECK-NEXT: br i1 [[TMP9_PEEL]], label [[BB10_PEEL:%.*]], label [[BB10_PEEL]]
26 ; CHECK-NEXT: [[TMP11_PEEL:%.*]] = icmp eq i8 undef, 0
27 ; CHECK-NEXT: br i1 [[TMP11_PEEL]], label [[BB12_PEEL:%.*]], label [[BB17_LOOPEXIT3:%.*]]
29 ; CHECK-NEXT: br i1 false, label [[BB13]], label [[BB2_PEEL_NEXT:%.*]]
30 ; CHECK: bb2.peel.next:
31 ; CHECK-NEXT: br label [[BB2_PEEL_NEXT1:%.*]]
32 ; CHECK: bb2.peel.next1:
33 ; CHECK-NEXT: br label [[BB1_PEEL_NEWPH:%.*]]
34 ; CHECK: bb1.peel.newph:
35 ; CHECK-NEXT: br label [[BB2:%.*]]
37 ; CHECK-NEXT: [[TMP3:%.*]] = phi i32 [ [[TMP4_PEEL]], [[BB1_PEEL_NEWPH]] ], [ [[TMP4:%.*]], [[BB12:%.*]] ]
38 ; CHECK-NEXT: [[TMP4]] = add nsw i32 [[TMP3]], [[TMP]]
39 ; CHECK-NEXT: br label [[BB5:%.*]]
41 ; CHECK-NEXT: br i1 undef, label [[BB7:%.*]], label [[BB15_LOOPEXIT:%.*]]
43 ; CHECK-NEXT: br i1 undef, label [[BB10:%.*]], label [[BB10]]
45 ; CHECK-NEXT: br i1 undef, label [[BB12]], label [[BB17_LOOPEXIT:%.*]]
47 ; CHECK-NEXT: br i1 false, label [[BB13_LOOPEXIT:%.*]], label [[BB2]], !llvm.loop [[LOOP0:![0-9]+]]
48 ; CHECK: bb13.loopexit:
49 ; CHECK-NEXT: br label [[BB13]]
51 ; CHECK-NEXT: [[TMP14]] = add nsw i32 [[TMP]], -1
52 ; CHECK-NEXT: br label [[BB1]]
53 ; CHECK: bb15.loopexit:
54 ; CHECK-NEXT: br label [[BB15:%.*]]
55 ; CHECK: bb15.loopexit2:
56 ; CHECK-NEXT: br label [[BB15]]
58 ; CHECK-NEXT: [[TMP16:%.*]] = call i32 (...) @llvm.experimental.deoptimize.i32(i32 17) [ "deopt"() ]
59 ; CHECK-NEXT: ret i32 [[TMP16]]
60 ; CHECK: bb17.loopexit:
61 ; CHECK-NEXT: br label [[BB17:%.*]]
62 ; CHECK: bb17.loopexit3:
63 ; CHECK-NEXT: br label [[BB17]]
65 ; CHECK-NEXT: [[TMP18:%.*]] = call i32 (...) @llvm.experimental.deoptimize.i32(i32 6) [ "deopt"() ]
66 ; CHECK-NEXT: ret i32 [[TMP18]]
71 bb1: ; preds = %bb13, %bb
72 %tmp = phi i32 [ -147, %bb ], [ %tmp14, %bb13 ]
75 bb2: ; preds = %bb12, %bb1
76 %tmp3 = phi i32 [ undef, %bb1 ], [ %tmp4, %bb12 ]
77 %tmp4 = add nsw i32 %tmp3, %tmp
81 %tmp6 = icmp eq i32 undef, 33
82 br i1 %tmp6, label %bb7, label %bb15
85 %tmp8 = sub nsw i32 %tmp3, undef
86 %tmp9 = icmp eq i32 %tmp8, 0
87 br i1 %tmp9, label %bb10, label %bb10
89 bb10: ; preds = %bb7, %bb7
90 %tmp11 = icmp eq i8 undef, 0
91 br i1 %tmp11, label %bb12, label %bb17
94 br i1 false, label %bb13, label %bb2
97 %tmp14 = add nsw i32 %tmp, -1
101 %tmp16 = call i32 (...) @llvm.experimental.deoptimize.i32(i32 17) [ "deopt"() ]
104 bb17: ; preds = %bb10
105 %tmp18 = call i32 (...) @llvm.experimental.deoptimize.i32(i32 6) [ "deopt"() ]
109 declare i32 @llvm.experimental.deoptimize.i32(...)