1; RUN: opt -loop-unroll -debug-only=loop-unroll -disable-output < %s 2; REQUIRES: asserts 3; Compile this test with debug flag on to verify domtree right after loop unrolling. 4target datalayout = "E-m:e-i1:8:16-i8:8:16-i64:64-f128:64-v128:64-a:8:16-n32:64" 5 6; PR27157 7define void @foo() { 8entry: 9 br label %loop_header 10loop_header: 11 %iv = phi i64 [ 0, %entry ], [ %iv_next, %loop_latch ] 12 br i1 undef, label %loop_latch, label %loop_exiting_bb1 13loop_exiting_bb1: 14 br i1 false, label %loop_exiting_bb2, label %exit1.loopexit 15loop_exiting_bb2: 16 br i1 false, label %loop_latch, label %bb 17bb: 18 br label %exit1 19loop_latch: 20 %iv_next = add nuw nsw i64 %iv, 1 21 %cmp = icmp ne i64 %iv_next, 2 22 br i1 %cmp, label %loop_header, label %exit2 23exit1.loopexit: 24 br label %exit1 25exit1: 26 ret void 27exit2: 28 ret void 29} 30 31define void @foo2() { 32entry: 33 br label %loop.header 34loop.header: 35 %iv = phi i32 [ 0, %entry ], [ %iv.inc, %latch ] 36 %iv.inc = add i32 %iv, 1 37 br i1 undef, label %diamond, label %latch 38diamond: 39 br i1 undef, label %left, label %right 40left: 41 br i1 undef, label %exit, label %merge 42right: 43 br i1 undef, label %exit, label %merge 44merge: 45 br label %latch 46latch: 47 %end.cond = icmp eq i32 %iv, 1 48 br i1 %end.cond, label %exit1, label %loop.header 49exit: 50 ret void 51exit1: 52 ret void 53} 54