blob: b9743ad33aad4a9b762bf59b9b6420dd92cf2b42 [file] [log] [blame]
Krzysztof Parzyszekd67ab622017-02-02 19:36:37 +00001; RUN: llc -march=hexagon < %s
2; REQUIRES: asserts
3
4; This code causes multiple endloop instructions to be generated for the
5; same loop. The findLoopInstr would encounter for one endloop would encounter
6; the other endloop, and return null in response. This resulted in a crash.
7;
8; Check that with the fix we are able to compile this code successfully.
9
10target triple = "hexagon"
11
12; Function Attrs: norecurse
13define void @fred() local_unnamed_addr #0 align 2 {
14b0:
15 br label %b7
16
17b1: ; preds = %b9
18 br i1 undef, label %b4, label %b2
19
20b2: ; preds = %b1
21 %v3 = sub i32 undef, undef
22 br label %b4
23
24b4: ; preds = %b2, %b1
25 %v5 = phi i32 [ undef, %b1 ], [ %v3, %b2 ]
26 br i1 undef, label %b14, label %b6
27
28b6: ; preds = %b4
29 br label %b10
30
31b7: ; preds = %b0
32 br i1 undef, label %b9, label %b8
33
34b8: ; preds = %b7
35 unreachable
36
37b9: ; preds = %b7
38 br label %b1
39
40b10: ; preds = %b21, %b6
41 %v11 = phi i32 [ %v22, %b21 ], [ %v5, %b6 ]
42 br i1 undef, label %b21, label %b12
43
44b12: ; preds = %b10
45 br label %b15
46
47b13: ; preds = %b21
48 br label %b14
49
50b14: ; preds = %b13, %b4
51 ret void
52
53b15: ; preds = %b12
54 br i1 undef, label %b16, label %b17
55
56b16: ; preds = %b15
57 store i32 0, i32* undef, align 4
58 br label %b21
59
60b17: ; preds = %b15
61 br label %b18
62
63b18: ; preds = %b17
64 br i1 undef, label %b19, label %b20
65
66b19: ; preds = %b18
67 br label %b21
68
69b20: ; preds = %b18
70 store i32 0, i32* undef, align 4
71 br label %b21
72
73b21: ; preds = %b20, %b19, %b16, %b10
74 %v22 = add i32 %v11, -8
75 %v23 = icmp eq i32 %v22, 0
76 br i1 %v23, label %b13, label %b10
77}
78
Sumanth Gundapanenie1983bc2017-10-18 18:07:07 +000079attributes #0 = { norecurse "target-cpu"="hexagonv60" "target-features"="-hvx,-long-calls" }