Files
clang-p2996/llvm/test/Transforms/LoopSimplify/update_latch_md2.ll
Hendrik Greving 4f93d5cc1d [BasicBlockUtils] Do not move loop metadata if outer loop header.
Fixes a bug preventing moving the loop's metadata to an outer loop's header,
which happens if the loop's exit is also the header of an outer loop.

Adjusts test for above.

Fixes #55416.

Differential Revision: https://reviews.llvm.org/D125574
2022-05-23 16:39:54 -07:00

35 lines
725 B
LLVM

; Tests loop-simplify does not move the loop metadata, because
; the loopexit block is not the latch of the loop _bb6.
; RUN: opt < %s -passes=loop-simplify -S | FileCheck %s
; CHECK-LABEL: loop.header.loopexit:
; CHECK: br label %loop.header, !llvm.loop !0
; CHECK-LABEL: loop.latch:
; CHECK: br i1 %p, label %loop.latch, label %loop.header.loopexit, !llvm.loop !0
define void @func(i1 %p) {
entry:
br label %loop.header
loop.header:
br i1 %p, label %bb1, label %exit
bb1:
br i1 %p, label %bb2, label %bb3
bb2:
br label %bb3
bb3:
br label %loop.latch
loop.latch:
br i1 %p, label %loop.latch, label %loop.header, !llvm.loop !0
exit:
ret void
}
!0 = distinct !{!0, !1}
!1 = !{!"llvm.loop.mustprogress"}