1 ; RUN: opt < %s -analyze -basicaa -lda | FileCheck %s
3 @x = common global [256 x i32] zeroinitializer, align 4
7 define void @f1(...) nounwind {
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)
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
24 ;; x[c] = x[c+1] // with c being a loop-invariant constant
26 define void @f2(i64 %c0) nounwind {
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
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
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
48 define void @f3(...) nounwind {
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)
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