1; RUN: llc -march=hexagon -enable-pipeliner < %s
2; REQUIRES: asserts
3
4; This test checks that we don't assert when the Phi value from the
5; loop is actually defined prior to the loop, e.g., from CSE.
6
7define fastcc void @f0() {
8b0:
9  br i1 undef, label %b10, label %b1
10
11b1:                                               ; preds = %b0
12  br i1 undef, label %b3, label %b2
13
14b2:                                               ; preds = %b1
15  br label %b8
16
17b3:                                               ; preds = %b1
18  br i1 undef, label %b4, label %b6
19
20b4:                                               ; preds = %b3
21  %v0 = load i16, i16* undef, align 2
22  br label %b7
23
24b5:                                               ; preds = %b7
25  br label %b6
26
27b6:                                               ; preds = %b5, %b3
28  %v1 = phi i16 [ %v9, %b5 ], [ 0, %b3 ]
29  br i1 undef, label %b10, label %b9
30
31b7:                                               ; preds = %b7, %b4
32  %v2 = phi i16 [ 0, %b7 ], [ %v0, %b4 ]
33  %v3 = phi i16 [ %v9, %b7 ], [ 0, %b4 ]
34  %v4 = phi i32 [ %v10, %b7 ], [ undef, %b4 ]
35  %v5 = or i16 0, %v3
36  %v6 = or i16 0, %v5
37  %v7 = or i16 0, %v6
38  %v8 = lshr i16 %v2, 8
39  %v9 = or i16 %v8, %v7
40  %v10 = add nsw i32 %v4, -32
41  %v11 = icmp sgt i32 %v10, 31
42  br i1 %v11, label %b7, label %b5
43
44b8:                                               ; preds = %b8, %b2
45  br label %b8
46
47b9:                                               ; preds = %b6
48  br label %b10
49
50b10:                                              ; preds = %b9, %b6, %b0
51  ret void
52}
53