1; RUN: opt -march=hexagon -O2 -S < %s
2; REQUIRES: asserts
3;
4; -fvectorize-loops infinite compile/memory
5; test checks that the compile completes successfully
6
7target triple = "hexagon"
8
9@g0 = global i8 -1, align 1
10@g1 = common global [15 x i8] zeroinitializer, align 8
11@g2 = common global [15 x i8*] zeroinitializer, align 8
12
13; Function Attrs: nounwind
14define void @f0() #0 {
15b0:
16  %v0 = alloca i32, align 4
17  store i32 0, i32* %v0, align 4
18  store i32 0, i32* %v0, align 4
19  br label %b1
20
21b1:                                               ; preds = %b3, %b0
22  %v1 = load i32, i32* %v0, align 4
23  %v2 = icmp slt i32 %v1, 15
24  br i1 %v2, label %b2, label %b4
25
26b2:                                               ; preds = %b1
27  %v3 = load i32, i32* %v0, align 4
28  %v4 = getelementptr inbounds [15 x i8], [15 x i8]* @g1, i32 0, i32 %v3
29  store i8 0, i8* %v4, align 1
30  %v5 = load i32, i32* %v0, align 4
31  %v6 = getelementptr inbounds [15 x i8*], [15 x i8*]* @g2, i32 0, i32 %v5
32  store i8* @g0, i8** %v6, align 4
33  br label %b3
34
35b3:                                               ; preds = %b2
36  %v7 = load i32, i32* %v0, align 4
37  %v8 = add nsw i32 %v7, 1
38  store i32 %v8, i32* %v0, align 4
39  br label %b1
40
41b4:                                               ; preds = %b1
42  ret void
43}
44
45attributes #0 = { nounwind }
46