blob: a5f504bafbf86ad0ff2da8af718c8ec8353b66c6 [file] [log] [blame]
Dan Gohman3c7d3082009-09-11 18:01:28 +00001; RUN: opt < %s -disable-output -analyze -lda | FileCheck %s
Andreas Bolkae2fc6c72009-07-23 15:56:53 +00002
Andreas Bolkaa6ee19c2009-07-28 23:40:40 +00003;; x[5] = x[6] // with x being a pointer passed as argument
Andreas Bolkae2fc6c72009-07-23 15:56:53 +00004
5define void @f1(i32* nocapture %xptr) nounwind {
6entry:
7 %x.ld.addr = getelementptr i32* %xptr, i64 6
8 %x.st.addr = getelementptr i32* %xptr, i64 5
9 br label %for.body
10
11for.body:
12 %i = phi i64 [ 0, %entry ], [ %i.next, %for.body ]
13 %x = load i32* %x.ld.addr
14 store i32 %x, i32* %x.st.addr
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
Andreas Bolkaa6ee19c2009-07-28 23:40:40 +000024;; x[5] = x[6] // with x being an array on the stack
Andreas Bolkae2fc6c72009-07-23 15:56:53 +000025
26define void @foo(...) nounwind {
27entry:
28 %xptr = alloca [256 x i32], align 4
29 %x.ld.addr = getelementptr [256 x i32]* %xptr, i64 0, i64 6
30 %x.st.addr = getelementptr [256 x i32]* %xptr, i64 0, i64 5
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 Bolkad2e1dd02009-08-05 04:26:05 +000037; CHECK: 0,1: ind
Andreas Bolkae2fc6c72009-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}