1; RUN: llc -march=hexagon -verify-machineinstrs < %s | FileCheck %s
2; REQUIRES: asserts
3
4; Check for some output (as opposed to a crash).
5; CHECK: loop0
6
7target triple = "hexagon"
8
9@x = external local_unnamed_addr global [80 x i32], align 8
10
11; Function Attrs: nounwind
12define void @fred() local_unnamed_addr #0 {
13b0:
14  br label %b1
15
16b1:                                               ; preds = %b20, %b0
17  br label %b2
18
19b2:                                               ; preds = %b2, %b1
20  %v3 = phi i32 [ 0, %b1 ], [ %v17, %b2 ]
21  %v4 = phi i32 [ 0, %b1 ], [ %v16, %b2 ]
22  %v5 = phi i32 [ undef, %b1 ], [ %v18, %b2 ]
23  %v6 = load i32, i32* undef, align 8
24  %v7 = icmp sgt i32 %v6, undef
25  %v8 = select i1 %v7, i32 %v3, i32 %v4
26  %v9 = select i1 undef, i32 0, i32 %v8
27  %v10 = select i1 undef, i32 undef, i32 %v9
28  %v11 = select i1 undef, i32 0, i32 %v10
29  %v12 = icmp sgt i32 undef, 0
30  %v13 = select i1 %v12, i32 undef, i32 %v11
31  %v14 = select i1 false, i32 undef, i32 %v13
32  %v15 = select i1 false, i32 undef, i32 %v14
33  %v16 = select i1 false, i32 undef, i32 %v15
34  %v17 = add nsw i32 %v3, 8
35  %v18 = add i32 %v5, -8
36  %v19 = icmp eq i32 %v18, 0
37  br i1 %v19, label %b20, label %b2
38
39b20:                                              ; preds = %b2
40  %v21 = getelementptr inbounds [80 x i32], [80 x i32]* @x, i32 0, i32 %v16
41  store i32 -2000, i32* %v21, align 4
42  br label %b1
43}
44
45attributes #0 = { nounwind "target-cpu"="hexagonv55" "target-features"="-hvx,-long-calls" }
46