Skip to content

Commit e5d8fb6

Browse files
author
Hendrik Greving
committed
[BasicBlockUtils] Add corner case test for loop metadata.
Adds a test to expose #55416. Differential Revision: https://reviews.llvm.org/D125696
1 parent 994a184 commit e5d8fb6

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
; Tests loop-simplify does not move the loop metadata, because
2+
; the loopexit block is not the latch of the loop _bb6.
3+
4+
; FIXME(#55416): The metadata should not move.
5+
6+
; RUN: opt < %s -passes=loop-simplify -S | FileCheck %s
7+
; CHECK-LABEL: loop.header.loopexit:
8+
; CHECK: br label %loop.header, !llvm.loop !0
9+
; CHECK-LABEL: loop.latch:
10+
; CHECK-NOT: br i1 %p, label %loop.latch, label %loop.header.loopexit, !llvm.loop !0
11+
12+
define void @func(i1 %p) {
13+
entry:
14+
br label %loop.header
15+
16+
loop.header:
17+
br i1 %p, label %bb1, label %exit
18+
19+
bb1:
20+
br i1 %p, label %bb2, label %bb3
21+
22+
bb2:
23+
br label %bb3
24+
25+
bb3:
26+
br label %loop.latch
27+
28+
loop.latch:
29+
br i1 %p, label %loop.latch, label %loop.header, !llvm.loop !0
30+
31+
exit:
32+
ret void
33+
}
34+
35+
!0 = distinct !{!0, !1}
36+
!1 = !{!"llvm.loop.mustprogress"}

0 commit comments

Comments
 (0)