122ebbc47SSidharth Baveja; REQUIRES: asserts 222ebbc47SSidharth Baveja; 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 322ebbc47SSidharth Baveja 422ebbc47SSidharth Baveja; CHECK: Loop Unroll and Jam: F[h] Loop %bb8 522ebbc47SSidharth Baveja; CHECK: Won't unroll-and-jam; only loops with single exit blocks can be unrolled and jammed 622ebbc47SSidharth Baveja 722ebbc47SSidharth Baveja@a = external global i16, align 2 822ebbc47SSidharth Baveja@e = external global i32, align 4 922ebbc47SSidharth Baveja@f = external global i16, align 2 1022ebbc47SSidharth Baveja@b = external global i16, align 2 1122ebbc47SSidharth Baveja@c = external global i64, align 8 1222ebbc47SSidharth Baveja 1322ebbc47SSidharth Bavejadefine void @h() { 1422ebbc47SSidharth Bavejabb: 15*055fb779SNikita Popov store i32 4, ptr @e, align 4 16*055fb779SNikita Popov %i15 = load i16, ptr @b, align 2 1722ebbc47SSidharth Baveja %i17 = icmp slt i16 %i15, 1 1822ebbc47SSidharth Baveja br label %bb8 1922ebbc47SSidharth Baveja 2022ebbc47SSidharth Bavejabb8: ; preds = %bb, %bb47 2122ebbc47SSidharth Baveja %storemerge15 = phi i32 [ 4, %bb ], [ %i49, %bb47 ] 2222ebbc47SSidharth Baveja br label %bb24 2322ebbc47SSidharth Baveja 2422ebbc47SSidharth Bavejabb24: ; preds = %bb43, %bb8 2522ebbc47SSidharth Baveja %storemerge312 = phi i16 [ 0, %bb8 ], [ %i45, %bb43 ] 2622ebbc47SSidharth Baveja br i1 %i17, label %bb46.preheader, label %bb43 2722ebbc47SSidharth Baveja 2822ebbc47SSidharth Bavejabb46.preheader: ; preds = %bb24 29*055fb779SNikita Popov store i16 %storemerge312, ptr @f, align 2 3022ebbc47SSidharth Baveja br label %bb46 3122ebbc47SSidharth Baveja 3222ebbc47SSidharth Bavejabb43: ; preds = %bb24 3322ebbc47SSidharth Baveja %i45 = add nuw nsw i16 %storemerge312, 1 3422ebbc47SSidharth Baveja %i13 = icmp ult i16 %storemerge312, 7 3522ebbc47SSidharth Baveja br i1 %i13, label %bb24, label %bb47 3622ebbc47SSidharth Baveja 3722ebbc47SSidharth Bavejabb46: ; preds = %bb46.preheader, %bb46 3822ebbc47SSidharth Baveja br label %bb46 3922ebbc47SSidharth Baveja 4022ebbc47SSidharth Bavejabb47: ; preds = %bb43 4122ebbc47SSidharth Baveja %i49 = add nsw i32 %storemerge15, -1 42*055fb779SNikita Popov store i32 %i49, ptr @e, align 4 4322ebbc47SSidharth Baveja %i7.not = icmp eq i32 %i49, 0 4422ebbc47SSidharth Baveja br i1 %i7.not, label %bb50, label %bb8 4522ebbc47SSidharth Baveja 4622ebbc47SSidharth Bavejabb50: ; preds = %bb47 47*055fb779SNikita Popov store i16 %i45, ptr @f, align 2 4822ebbc47SSidharth Baveja ret void 4922ebbc47SSidharth Baveja} 50