1 ; RUN: llc -march=hexagon < %s
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.
8 ; Check that with the fix we are able to compile this code successfully.
10 target triple = "hexagon"
12 ; Function Attrs: norecurse
13 define void @fred() local_unnamed_addr #0 align 2 {
18 br i1 undef, label %b4, label %b2
21 %v3 = sub i32 undef, undef
24 b4: ; preds = %b2, %b1
25 %v5 = phi i32 [ undef, %b1 ], [ %v3, %b2 ]
26 br i1 undef, label %b14, label %b6
32 br i1 undef, label %b9, label %b8
40 b10: ; preds = %b21, %b6
41 %v11 = phi i32 [ %v22, %b21 ], [ %v5, %b6 ]
42 br i1 undef, label %b21, label %b12
50 b14: ; preds = %b13, %b4
54 br i1 undef, label %b16, label %b17
57 store i32 0, i32* undef, align 4
64 br i1 undef, label %b19, label %b20
70 store i32 0, i32* undef, align 4
73 b21: ; 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
79 attributes #0 = { norecurse "target-cpu"="hexagonv60" "target-features"="-hvx,-long-calls" }