blob: f77156305c260d431b0e4f123786151bb76b1788 [file] [log] [blame]
Chandler Carruth5da53432012-07-02 18:37:59 +00001; RUN: opt < %s -basicaa -aa-eval -print-all-alias-modref-info 2>&1 | FileCheck %s
Dan Gohman776e4c82009-05-27 01:48:27 +00002; PR4267
3
Ahmed Bougachaa7e33112015-02-05 21:10:14 +00004target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
5
Michael Kruse47f85602017-06-21 18:25:37 +00006; CHECK: MayAlias: double* %p.0.i.0, double* %p3
Michael J. Spencer798334042010-08-30 15:08:02 +00007
Dan Gohman776e4c82009-05-27 01:48:27 +00008; %p3 is equal to %p.0.i.0 on the second iteration of the loop,
Ahmed Bougachaa7e33112015-02-05 21:10:14 +00009; so MayAlias is needed. In practice, basicaa returns PartialAlias
10; for GEPs to ignore TBAA.
Dan Gohman776e4c82009-05-27 01:48:27 +000011
12define void @foo([3 x [3 x double]]* noalias %p) {
13entry:
David Blaikie79e6c742015-02-27 19:29:02 +000014 %p3 = getelementptr [3 x [3 x double]], [3 x [3 x double]]* %p, i64 0, i64 0, i64 3
Dan Gohman776e4c82009-05-27 01:48:27 +000015 br label %loop
16
17loop:
18 %i = phi i64 [ 0, %entry ], [ %i.next, %loop ]
19
David Blaikie79e6c742015-02-27 19:29:02 +000020 %p.0.i.0 = getelementptr [3 x [3 x double]], [3 x [3 x double]]* %p, i64 0, i64 %i, i64 0
Dan Gohman776e4c82009-05-27 01:48:27 +000021
Chris Lattner6a144a22011-11-27 06:54:59 +000022 store volatile double 0.0, double* %p3
23 store volatile double 0.1, double* %p.0.i.0
Dan Gohman776e4c82009-05-27 01:48:27 +000024
25 %i.next = add i64 %i, 1
26 %cmp = icmp slt i64 %i.next, 3
27 br i1 %cmp, label %loop, label %exit
28
29exit:
30 ret void
31}