1; This test checks that nested loops are revisited in various scenarios when 2; unrolling. Note that if we ever start doing outer loop peeling a test case 3; for that should be added here. 4; 5; RUN: opt < %s -disable-output -debug-pass-manager 2>&1 \ 6; RUN: -passes='require<opt-remark-emit>,loop(loop-unroll-full)' \ 7; RUN: | FileCheck %s 8; 9; Basic test is fully unrolled and we revisit the post-unroll new sibling 10; loops, including the ones that used to be child loops. 11define void @full_unroll(ptr %ptr) { 12; CHECK-LABEL: OptimizationRemarkEmitterAnalysis on full_unroll 13; CHECK-NOT: LoopFullUnrollPass 14 15entry: 16 br label %l0 17 18l0: 19 %cond.0 = load volatile i1, ptr %ptr 20 br i1 %cond.0, label %l0.0.ph, label %exit 21 22l0.0.ph: 23 br label %l0.0 24 25l0.0: 26 %iv = phi i32 [ %iv.next, %l0.0.latch ], [ 0, %l0.0.ph ] 27 %iv.next = add i32 %iv, 1 28 br label %l0.0.0.ph 29 30l0.0.0.ph: 31 br label %l0.0.0 32 33l0.0.0: 34 %cond.0.0.0 = load volatile i1, ptr %ptr 35 br i1 %cond.0.0.0, label %l0.0.0, label %l0.0.1.ph 36; CHECK: LoopFullUnrollPass on loop %l0.0.0 37; CHECK-NOT: LoopFullUnrollPass 38 39l0.0.1.ph: 40 br label %l0.0.1 41 42l0.0.1: 43 %cond.0.0.1 = load volatile i1, ptr %ptr 44 br i1 %cond.0.0.1, label %l0.0.1, label %l0.0.latch 45; CHECK: LoopFullUnrollPass on loop %l0.0.1 in function full_unroll 46; CHECK-NOT: LoopFullUnrollPass 47 48l0.0.latch: 49 %cmp = icmp slt i32 %iv.next, 2 50 br i1 %cmp, label %l0.0, label %l0.latch 51; CHECK: LoopFullUnrollPass on loop %l0.0 in function full_unroll 52; CHECK-NOT: LoopFullUnrollPass 53; 54; Unrolling occurs, so we visit what were the inner loops twice over. First we 55; visit their clones, and then we visit the original loops re-parented. 56; CHECK: LoopFullUnrollPass on loop %l0.0.1.1 in function full_unroll 57; CHECK-NOT: LoopFullUnrollPass 58; CHECK: LoopFullUnrollPass on loop %l0.0.0.1 in function full_unroll 59; CHECK-NOT: LoopFullUnrollPass 60; CHECK: LoopFullUnrollPass on loop %l0.0.1 in function full_unroll 61; CHECK-NOT: LoopFullUnrollPass 62; CHECK: LoopFullUnrollPass on loop %l0.0.0 in function full_unroll 63; CHECK-NOT: LoopFullUnrollPass 64 65l0.latch: 66 br label %l0 67; CHECK: LoopFullUnrollPass on loop %l0 in function full_unroll 68; CHECK-NOT: LoopFullUnrollPass 69 70exit: 71 ret void 72} 73