1; RUN: opt -S < %s -loop-unroll -block-freq | FileCheck %s
2; RUN: opt -S < %s -passes='require<opt-remark-emit>,loop-unroll,require<block-freq>' | FileCheck %s
3; Crasher from PR20987.
4
5; CHECK: define void @update_loop_info_in_subloops
6; CHECK: entry:
7; CHECK: L:
8; CHECK: L.inner:
9; CHECK: L.inner.latch:
10; CHECK: L.latch:
11; CHECK: L.inner.1:
12; CHECK: L.inner.latch.1:
13; CHECK: L.latch.1:
14
15define void @update_loop_info_in_subloops() {
16entry:
17  br label %L
18
19L:
20  %0 = phi i64 [ 1, %entry ], [ %1, %L.latch ]
21  br label %L.inner
22
23L.inner:
24  br label %L.inner.latch
25
26L.inner.latch:
27  br i1 false, label %L.latch, label %L.inner
28
29L.latch:
30  %1 = add i64 %0, 1
31  %2 = icmp eq i64 %1, 3
32  br i1 %2, label %exit, label %L
33
34exit:
35  ret void
36}
37