blob: b099a57ae73adc9cfe1ae3b12da07b89d3591dda [file] [log] [blame]
Andreas Bolka0dcde102009-07-23 15:56:53 +00001; RUN: llvm-as < %s | opt -disable-output -analyze -lda | FileCheck %s
2
3@x = common global [256 x i32] zeroinitializer, align 4
4
5; x[5] = x[6]
6
7define void @f1(...) nounwind {
8entry:
9 br label %for.body
10
11for.body:
12 %i = phi i64 [ 0, %entry ], [ %i.next, %for.body ]
13 %x = load i32* getelementptr ([256 x i32]* @x, i32 0, i64 6)
14 store i32 %x, i32* getelementptr ([256 x i32]* @x, i32 0, i64 5)
15; CHECK: 0,1: dep
16 %i.next = add i64 %i, 1
17 %exitcond = icmp eq i64 %i.next, 256
18 br i1 %exitcond, label %for.end, label %for.body
19
20for.end:
21 ret void
22}
23
24; x[c] = x[c+1] // with c being a loop-invariant constant
25
26define void @f2(i64 %c0) nounwind {
27entry:
28 %c1 = add i64 %c0, 1
29 %x.ld.addr = getelementptr [256 x i32]* @x, i64 0, i64 %c0
30 %x.st.addr = getelementptr [256 x i32]* @x, i64 0, i64 %c1
31 br label %for.body
32
33for.body:
34 %i = phi i64 [ 0, %entry ], [ %i.next, %for.body ]
35 %x = load i32* %x.ld.addr
36 store i32 %x, i32* %x.st.addr
37; CHECK: 0,1: dep
38 %i.next = add i64 %i, 1
39 %exitcond = icmp eq i64 %i.next, 256
40 br i1 %exitcond, label %for.end, label %for.body
41
42for.end:
43 ret void
44}