1; RUN: llc -march=hexagon -verify-machineinstrs < %s | FileCheck %s
2; REQUIRES: asserts
3
4; Check for some sane output. This test used to crash.
5; CHECK: jumpr r31
6
7
8define i32 @fred(i32 %a0, i8 zeroext %a1) local_unnamed_addr #0 {
9b2:
10  br i1 undef, label %b4, label %b3
11
12b3:                                               ; preds = %b2
13  unreachable
14
15b4:                                               ; preds = %b2
16  br i1 undef, label %b19, label %b5
17
18b5:                                               ; preds = %b4
19  br i1 undef, label %b6, label %b12
20
21b6:                                               ; preds = %b5
22  switch i8 %a1, label %b17 [
23    i8 2, label %b7
24    i8 5, label %b7
25    i8 1, label %b7
26    i8 3, label %b8
27  ]
28
29b7:                                               ; preds = %b6, %b6, %b6
30  unreachable
31
32b8:                                               ; preds = %b6
33  br i1 undef, label %b11, label %b9
34
35b9:                                               ; preds = %b8
36  %v10 = or i32 undef, 0
37  br label %b15
38
39b11:                                              ; preds = %b8
40  unreachable
41
42b12:                                              ; preds = %b5
43  switch i8 %a1, label %b17 [
44    i8 5, label %b13
45    i8 1, label %b13
46    i8 2, label %b14
47    i8 3, label %b15
48  ]
49
50b13:                                              ; preds = %b12, %b12
51  store i32 %a0, i32* undef, align 4
52  br label %b17
53
54b14:                                              ; preds = %b12
55  store i16 undef, i16* undef, align 4
56  br label %b17
57
58b15:                                              ; preds = %b12, %b9
59  %v16 = phi i32 [ 0, %b12 ], [ %v10, %b9 ]
60  store i32 undef, i32* undef, align 4
61  br label %b17
62
63b17:                                              ; preds = %b15, %b14, %b13, %b12, %b6
64  %v18 = phi i32 [ 0, %b13 ], [ 0, %b12 ], [ %v16, %b15 ], [ 0, %b14 ], [ 0, %b6 ]
65  ret i32 %v18
66
67b19:                                              ; preds = %b4
68  unreachable
69}
70
71attributes #0 = { nounwind "target-cpu"="hexagonv55" "target-features"="-hvx,-long-calls" }
72