[BasicBlockUtils] Add corner case test for loop metadata.

Adds a test to expose #55416.

Differential Revision: https://reviews.llvm.org/D125696
This commit is contained in:
Hendrik Greving 2022-05-16 07:34:04 -07:00
parent 994a1841eb
commit e5d8fb690e
1 changed files with 36 additions and 0 deletions

View File

@ -0,0 +1,36 @@
; Tests loop-simplify does not move the loop metadata, because
; the loopexit block is not the latch of the loop _bb6.
; FIXME(#55416): The metadata should not move.
; 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-NOT: 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"}