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
4 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"
5 target triple = "x86_64-unknown-linux-gnu"
10 ; CHECK-NEXT: br label [[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:%.*]]
17 ; CHECK-NEXT: [[TMP4_PEEL:%.*]] = add nsw i32 undef, [[TMP]]
18 ; CHECK-NEXT: br label [[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:%.*]]
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]]
27 ; CHECK-NEXT: [[TMP11_PEEL:%.*]] = icmp eq i8 undef, 0
28 ; CHECK-NEXT: br i1 [[TMP11_PEEL]], label [[BB12_PEEL:%.*]], label [[BB17_LOOPEXIT3:%.*]]
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:%.*]]
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:%.*]]
42 ; CHECK-NEXT: br i1 undef, label [[BB7:%.*]], label [[BB15_LOOPEXIT:%.*]]
44 ; CHECK-NEXT: br i1 undef, label [[BB10:%.*]], label [[BB10]]
46 ; CHECK-NEXT: br i1 undef, label [[BB12]], label [[BB17_LOOPEXIT:%.*]]
48 ; CHECK-NEXT: br i1 false, label [[BB13_LOOPEXIT:%.*]], label [[BB2]], !llvm.loop [[LOOP0:![0-9]+]]
49 ; CHECK: bb13.loopexit:
50 ; CHECK-NEXT: br label [[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]]
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]]
66 ; CHECK-NEXT: [[TMP18:%.*]] = call i32 (...) @llvm.experimental.deoptimize.i32(i32 6) [ "deopt"() ]
67 ; CHECK-NEXT: ret i32 [[TMP18]]
72 bb1: ; preds = %bb13, %bb
73 %tmp = phi i32 [ -147, %bb ], [ %tmp14, %bb13 ]
76 bb2: ; preds = %bb12, %bb1
77 %tmp3 = phi i32 [ undef, %bb1 ], [ %tmp4, %bb12 ]
78 %tmp4 = add nsw i32 %tmp3, %tmp
82 %tmp6 = icmp eq i32 undef, 33
83 br i1 %tmp6, label %bb7, label %bb15
86 %tmp8 = sub nsw i32 %tmp3, undef
87 %tmp9 = icmp eq i32 %tmp8, 0
88 br i1 %tmp9, label %bb10, label %bb10
90 bb10: ; preds = %bb7, %bb7
91 %tmp11 = icmp eq i8 undef, 0
92 br i1 %tmp11, label %bb12, label %bb17
95 br i1 false, label %bb13, label %bb2
98 %tmp14 = add nsw i32 %tmp, -1
102 %tmp16 = call i32 (...) @llvm.experimental.deoptimize.i32(i32 17) [ "deopt"() ]
105 bb17: ; preds = %bb10
106 %tmp18 = call i32 (...) @llvm.experimental.deoptimize.i32(i32 6) [ "deopt"() ]
110 declare i32 @llvm.experimental.deoptimize.i32(...)