1 ; RUN: llvm-as < %s | opt -disable-output -analyze -lda | FileCheck %s
3 @x = common global [256 x i32] zeroinitializer, align 4
4 @y = common global [256 x i32] zeroinitializer, align 4
6 ;; for (i = 0; i < 256; i++)
9 define void @f1(...) nounwind {
14 %i = phi i64 [ 0, %entry ], [ %i.next, %for.body ]
15 %y.addr = getelementptr [256 x i32]* @y, i64 0, i64 %i
16 %x.addr = getelementptr [256 x i32]* @x, i64 0, i64 %i
17 %x = load i32* %x.addr ; 0
18 %y = load i32* %y.addr ; 1
20 store i32 %r, i32* %x.addr ; 2
23 %i.next = add i64 %i, 1
24 %exitcond = icmp eq i64 %i.next, 256
25 br i1 %exitcond, label %for.end, label %for.body
31 ;; for (i = 0; i < 256; i++)
32 ;; x[i+1] = x[i] + y[i]
34 define void @f2(...) nounwind {
39 %i = phi i64 [ 0, %entry ], [ %i.next, %for.body ]
40 %y.ld.addr = getelementptr [256 x i32]* @y, i64 0, i64 %i
41 %x.ld.addr = getelementptr [256 x i32]* @x, i64 0, i64 %i
42 %i.next = add i64 %i, 1
43 %x.st.addr = getelementptr [256 x i32]* @x, i64 0, i64 %i.next
44 %x = load i32* %x.ld.addr ; 0
45 %y = load i32* %y.ld.addr ; 1
47 store i32 %r, i32* %x.st.addr ; 2
50 %exitcond = icmp eq i64 %i.next, 256
51 br i1 %exitcond, label %for.end, label %for.body
57 ;; for (i = 0; i < 10; i++)
58 ;; x[i+20] = x[i] + y[i]
60 define void @f3(...) nounwind {
65 %i = phi i64 [ 0, %entry ], [ %i.next, %for.body ]
66 %y.ld.addr = getelementptr [256 x i32]* @y, i64 0, i64 %i
67 %x.ld.addr = getelementptr [256 x i32]* @x, i64 0, i64 %i
68 %i.20 = add i64 %i, 20
69 %x.st.addr = getelementptr [256 x i32]* @x, i64 0, i64 %i.20
70 %x = load i32* %x.ld.addr ; 0
71 %y = load i32* %y.ld.addr ; 1
73 store i32 %r, i32* %x.st.addr ; 2
76 %i.next = add i64 %i, 1
77 %exitcond = icmp eq i64 %i.next, 10
78 br i1 %exitcond, label %for.end, label %for.body
84 ;; for (i = 0; i < 10; i++)
85 ;; x[10*i+1] = x[10*i] + y[i]
87 define void @f4(...) nounwind {
92 %i = phi i64 [ 0, %entry ], [ %i.next, %for.body ]
93 %i.10 = mul i64 %i, 10
94 %y.ld.addr = getelementptr [256 x i32]* @y, i64 0, i64 %i.10
95 %x.ld.addr = getelementptr [256 x i32]* @x, i64 0, i64 %i.10
96 %i.10.1 = add i64 %i.10, 1
97 %x.st.addr = getelementptr [256 x i32]* @x, i64 0, i64 %i.10.1
98 %x = load i32* %x.ld.addr ; 0
99 %y = load i32* %y.ld.addr ; 1
101 store i32 %r, i32* %x.st.addr ; 2
104 %i.next = add i64 %i, 1
105 %exitcond = icmp eq i64 %i.next, 10
106 br i1 %exitcond, label %for.end, label %for.body