Files
clang-p2996/llvm/test/Transforms/LoopUnrollAndJam/delete_middle_loop.ll
David Green 3ef33066bb [UnrollAndJam] Do not preserve loop nests if a loop was fully unrolled. (#133510)
If UnJ completely unrolls a loop and removes it entirely, the loop
remains in the current loop nest. If the loop nest gets reused the loops
will no longer be valid. As there is no way to remove a loop from a
LoopNest, this patch removes the preserve of the LoopNestAnalysis so
that it will be regenerated.

Fixes #124518
2025-03-29 19:21:34 +00:00

37 lines
1.3 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
; RUN: opt -passes="loop(invalidate<all>,loop-unroll-and-jam,loop-unroll-and-jam)" -allow-unroll-and-jam -unroll-and-jam-count=4 < %s -S | FileCheck %s
; This test completely unrolls the middle loop out of a 3-deep loop nest.
define i16 @test_it() {
; CHECK-LABEL: define i16 @test_it() {
; CHECK-NEXT: [[ENTRY:.*:]]
; CHECK-NEXT: br label %[[FOR_COND:.*]]
; CHECK: [[FOR_COND_LOOPEXIT:.*]]:
; CHECK-NEXT: br label %[[FOR_COND]]
; CHECK: [[FOR_COND]]:
; CHECK-NEXT: br label %[[DO_BODY2:.*]]
; CHECK: [[DO_BODY2]]:
; CHECK-NEXT: br label %[[WHILE_COND3:.*]]
; CHECK: [[WHILE_COND3]]:
; CHECK-NEXT: br i1 true, label %[[DO_COND:.*]], label %[[WHILE_COND3]]
; CHECK: [[DO_COND]]:
; CHECK-NEXT: br label %[[FOR_COND_LOOPEXIT]]
;
entry:
br label %for.cond
for.cond: ; preds = %do.cond, %entry
br label %do.body2
do.body2: ; preds = %do.cond, %for.cond
br label %while.cond3
while.cond3: ; preds = %while.cond3, %do.body2
br i1 true, label %do.cond, label %while.cond3
do.cond: ; preds = %while.cond3
br i1 true, label %for.cond, label %do.body2
}