blob: 98161bff9273d29e05405d1f9c07132a16ea3ee1 [file] [log] [blame]
Arnold Schwaighofer833a82e2014-01-03 05:47:03 +00001; RUN: opt < %s -basicaa -aa-eval -disable-output 2>&1 | FileCheck %s
Tanya Lattnerf865dcd2008-02-14 06:56:27 +00002; TEST that A[1][0] may alias A[0][i].
Kenneth Uildriks90fedc62009-11-03 15:29:06 +00003target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128"
Chris Lattner05285fb2006-03-04 02:05:07 +00004
Bill Wendlingcd6df162012-04-24 09:15:38 +00005; CHECK: 2 no alias responses
6
Tanya Lattnerf865dcd2008-02-14 06:56:27 +00007define void @test(i32 %N) {
Chris Lattner05285fb2006-03-04 02:05:07 +00008entry:
Tanya Lattnerf865dcd2008-02-14 06:56:27 +00009 %X = alloca [3 x [3 x i32]] ; <[3 x [3 x i32]]*> [#uses=4]
10 %tmp.24 = icmp sgt i32 %N, 0 ; <i1> [#uses=1]
11 br i1 %tmp.24, label %no_exit, label %loopexit
Chris Lattner05285fb2006-03-04 02:05:07 +000012
13no_exit: ; preds = %no_exit, %entry
Tanya Lattnerf865dcd2008-02-14 06:56:27 +000014 %i.0.0 = phi i32 [ 0, %entry ], [ %inc, %no_exit ] ; <i32> [#uses=2]
David Blaikie79e6c742015-02-27 19:29:02 +000015 %tmp.6 = getelementptr [3 x [3 x i32]], [3 x [3 x i32]]* %X, i32 0, i32 0, i32 %i.0.0 ; <i32*> [#uses=1]
Tanya Lattnerf865dcd2008-02-14 06:56:27 +000016 store i32 1, i32* %tmp.6
David Blaikie79e6c742015-02-27 19:29:02 +000017 %tmp.8 = getelementptr [3 x [3 x i32]], [3 x [3 x i32]]* %X, i32 0, i32 0, i32 0 ; <i32*> [#uses=1]
David Blaikiea79ac142015-02-27 21:17:42 +000018 %tmp.9 = load i32, i32* %tmp.8 ; <i32> [#uses=1]
David Blaikie79e6c742015-02-27 19:29:02 +000019 %tmp.11 = getelementptr [3 x [3 x i32]], [3 x [3 x i32]]* %X, i32 0, i32 1, i32 0 ; <i32*> [#uses=1]
David Blaikiea79ac142015-02-27 21:17:42 +000020 %tmp.12 = load i32, i32* %tmp.11 ; <i32> [#uses=1]
Tanya Lattnerf865dcd2008-02-14 06:56:27 +000021 %tmp.13 = add i32 %tmp.12, %tmp.9 ; <i32> [#uses=1]
22 %inc = add i32 %i.0.0, 1 ; <i32> [#uses=2]
23 %tmp.2 = icmp slt i32 %inc, %N ; <i1> [#uses=1]
24 br i1 %tmp.2, label %no_exit, label %loopexit
Chris Lattner05285fb2006-03-04 02:05:07 +000025
26loopexit: ; preds = %no_exit, %entry
Tanya Lattnerf865dcd2008-02-14 06:56:27 +000027 %Y.0.1 = phi i32 [ 0, %entry ], [ %tmp.13, %no_exit ] ; <i32> [#uses=1]
David Blaikie79e6c742015-02-27 19:29:02 +000028 %tmp.4 = getelementptr [3 x [3 x i32]], [3 x [3 x i32]]* %X, i32 0, i32 0 ; <[3 x i32]*> [#uses=1]
David Blaikie23af6482015-04-16 23:24:18 +000029 %tmp.15 = call i32 (...) @foo( [3 x i32]* %tmp.4, i32 %Y.0.1 ) ; <i32> [#uses=0]
Chris Lattner05285fb2006-03-04 02:05:07 +000030 ret void
31}
32
Tanya Lattnerf865dcd2008-02-14 06:56:27 +000033declare i32 @foo(...)