blob: 5d08312791f20952582f8240ff7f4560bffaef8d [file] [log] [blame]
Dan Gohmanf2f6ce62009-09-11 18:01:28 +00001; RUN: opt < %s -aa-eval -disable-output |& grep {2 no alias respon}
Tanya Lattnerdcd188d2008-02-14 06:56:27 +00002; TEST that A[1][0] may alias A[0][i].
Chris Lattner42983652006-03-04 02:05:07 +00003
Tanya Lattnerdcd188d2008-02-14 06:56:27 +00004define void @test(i32 %N) {
Chris Lattner42983652006-03-04 02:05:07 +00005entry:
Tanya Lattnerdcd188d2008-02-14 06:56:27 +00006 %X = alloca [3 x [3 x i32]] ; <[3 x [3 x i32]]*> [#uses=4]
7 %tmp.24 = icmp sgt i32 %N, 0 ; <i1> [#uses=1]
8 br i1 %tmp.24, label %no_exit, label %loopexit
Chris Lattner42983652006-03-04 02:05:07 +00009
10no_exit: ; preds = %no_exit, %entry
Tanya Lattnerdcd188d2008-02-14 06:56:27 +000011 %i.0.0 = phi i32 [ 0, %entry ], [ %inc, %no_exit ] ; <i32> [#uses=2]
12 %tmp.6 = getelementptr [3 x [3 x i32]]* %X, i32 0, i32 0, i32 %i.0.0 ; <i32*> [#uses=1]
13 store i32 1, i32* %tmp.6
14 %tmp.8 = getelementptr [3 x [3 x i32]]* %X, i32 0, i32 0, i32 0 ; <i32*> [#uses=1]
15 %tmp.9 = load i32* %tmp.8 ; <i32> [#uses=1]
16 %tmp.11 = getelementptr [3 x [3 x i32]]* %X, i32 0, i32 1, i32 0 ; <i32*> [#uses=1]
17 %tmp.12 = load i32* %tmp.11 ; <i32> [#uses=1]
18 %tmp.13 = add i32 %tmp.12, %tmp.9 ; <i32> [#uses=1]
19 %inc = add i32 %i.0.0, 1 ; <i32> [#uses=2]
20 %tmp.2 = icmp slt i32 %inc, %N ; <i1> [#uses=1]
21 br i1 %tmp.2, label %no_exit, label %loopexit
Chris Lattner42983652006-03-04 02:05:07 +000022
23loopexit: ; preds = %no_exit, %entry
Tanya Lattnerdcd188d2008-02-14 06:56:27 +000024 %Y.0.1 = phi i32 [ 0, %entry ], [ %tmp.13, %no_exit ] ; <i32> [#uses=1]
25 %tmp.4 = getelementptr [3 x [3 x i32]]* %X, i32 0, i32 0 ; <[3 x i32]*> [#uses=1]
26 %tmp.15 = call i32 (...)* @foo( [3 x i32]* %tmp.4, i32 %Y.0.1 ) ; <i32> [#uses=0]
Chris Lattner42983652006-03-04 02:05:07 +000027 ret void
28}
29
Tanya Lattnerdcd188d2008-02-14 06:56:27 +000030declare i32 @foo(...)