blob: ba459487743467872430c28ef900b54a4fcc5a0c [file] [log] [blame]
Dan Gohman8a977e22010-01-26 19:25:59 +00001; RUN: opt < %s -analyze -lda | FileCheck %s
Andreas Bolka0dcde102009-07-23 15:56:53 +00002
3@x = common global [256 x i32] zeroinitializer, align 4
4
Andreas Bolka7b43f5c2009-07-28 23:40:40 +00005;; x[5] = x[6]
Andreas Bolka0dcde102009-07-23 15:56:53 +00006
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)
Andreas Bolka831f6f62009-08-05 04:26:05 +000015; CHECK: 0,1: ind
Andreas Bolka0dcde102009-07-23 15:56:53 +000016 %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
Andreas Bolka7b43f5c2009-07-28 23:40:40 +000024;; x[c] = x[c+1] // with c being a loop-invariant constant
Andreas Bolka0dcde102009-07-23 15:56:53 +000025
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
Andreas Bolka831f6f62009-08-05 04:26:05 +000037; CHECK: 0,1: ind
Andreas Bolka0dcde102009-07-23 15:56:53 +000038 %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}
Andreas Bolkac20a6fd2009-08-02 23:28:14 +000045
46;; x[6] = x[6]
47
48define void @f3(...) nounwind {
49entry:
50 br label %for.body
51
52for.body:
53 %i = phi i64 [ 0, %entry ], [ %i.next, %for.body ]
54 %x = load i32* getelementptr ([256 x i32]* @x, i32 0, i64 6)
55 store i32 %x, i32* getelementptr ([256 x i32]* @x, i32 0, i64 6)
56; CHECK: 0,1: dep
57 %i.next = add i64 %i, 1
58 %exitcond = icmp eq i64 %i.next, 256
59 br i1 %exitcond, label %for.end, label %for.body
60
61for.end:
62 ret void
63}