73 lines · plain
1; This test checks that nested loops are revisited in various scenarios when2; unrolling. Note that if we ever start doing outer loop peeling a test case3; 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 %s8; 9; Basic test is fully unrolled and we revisit the post-unroll new sibling10; loops, including the ones that used to be child loops.11define void @full_unroll(ptr %ptr) {12; CHECK-LABEL: OptimizationRemarkEmitterAnalysis on full_unroll13; CHECK-NOT: LoopFullUnrollPass14 15entry:16 br label %l017 18l0:19 %cond.0 = load volatile i1, ptr %ptr20 br i1 %cond.0, label %l0.0.ph, label %exit21 22l0.0.ph:23 br label %l0.024 25l0.0:26 %iv = phi i32 [ %iv.next, %l0.0.latch ], [ 0, %l0.0.ph ]27 %iv.next = add i32 %iv, 128 br label %l0.0.0.ph29 30l0.0.0.ph:31 br label %l0.0.032 33l0.0.0:34 %cond.0.0.0 = load volatile i1, ptr %ptr35 br i1 %cond.0.0.0, label %l0.0.0, label %l0.0.1.ph36; CHECK: LoopFullUnrollPass on loop %l0.0.037; CHECK-NOT: LoopFullUnrollPass38 39l0.0.1.ph:40 br label %l0.0.141 42l0.0.1:43 %cond.0.0.1 = load volatile i1, ptr %ptr44 br i1 %cond.0.0.1, label %l0.0.1, label %l0.0.latch45; CHECK: LoopFullUnrollPass on loop %l0.0.1 in function full_unroll46; CHECK-NOT: LoopFullUnrollPass47 48l0.0.latch:49 %cmp = icmp slt i32 %iv.next, 250 br i1 %cmp, label %l0.0, label %l0.latch51; CHECK: LoopFullUnrollPass on loop %l0.0 in function full_unroll52; CHECK-NOT: LoopFullUnrollPass53;54; Unrolling occurs, so we visit what were the inner loops twice over. First we55; 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: LoopFullUnrollPass58; CHECK: LoopFullUnrollPass on loop %l0.0.0.1 in function full_unroll59; CHECK-NOT: LoopFullUnrollPass60; CHECK: LoopFullUnrollPass on loop %l0.0.1 in function full_unroll61; CHECK-NOT: LoopFullUnrollPass62; CHECK: LoopFullUnrollPass on loop %l0.0.0 in function full_unroll63; CHECK-NOT: LoopFullUnrollPass64 65l0.latch:66 br label %l067; CHECK: LoopFullUnrollPass on loop %l0 in function full_unroll68; CHECK-NOT: LoopFullUnrollPass69 70exit:71 ret void72}73