2 ; RUN: opt -debug-only=loop-unroll-and-jam -passes="loop-unroll-and-jam" -enable-unroll-and-jam -allow-unroll-and-jam -unroll-and-jam-count=8 -disable-output %s 2>&1 | FileCheck %s
4 ; CHECK: Loop Unroll and Jam: F[h] Loop %bb8
5 ; CHECK: Won't unroll-and-jam; only loops with single exit blocks can be unrolled and jammed
7 @a = external global i16, align 2
8 @e = external global i32, align 4
9 @f = external global i16, align 2
10 @b = external global i16, align 2
11 @c = external global i64, align 8
15 store i32 4, ptr @e, align 4
16 %i15 = load i16, ptr @b, align 2
17 %i17 = icmp slt i16 %i15, 1
20 bb8: ; preds = %bb, %bb47
21 %storemerge15 = phi i32 [ 4, %bb ], [ %i49, %bb47 ]
24 bb24: ; preds = %bb43, %bb8
25 %storemerge312 = phi i16 [ 0, %bb8 ], [ %i45, %bb43 ]
26 br i1 %i17, label %bb46.preheader, label %bb43
28 bb46.preheader: ; preds = %bb24
29 store i16 %storemerge312, ptr @f, align 2
33 %i45 = add nuw nsw i16 %storemerge312, 1
34 %i13 = icmp ult i16 %storemerge312, 7
35 br i1 %i13, label %bb24, label %bb47
37 bb46: ; preds = %bb46.preheader, %bb46
41 %i49 = add nsw i32 %storemerge15, -1
42 store i32 %i49, ptr @e, align 4
43 %i7.not = icmp eq i32 %i49, 0
44 br i1 %i7.not, label %bb50, label %bb8
47 store i16 %i45, ptr @f, align 2