Optimize icmp of null and select of two constants even if the select has
[oota-llvm.git] / test / Analysis / BasicAA / constant-over-index.ll
1 ; RUN: opt < %s -aa-eval -print-all-alias-modref-info \
2 ; RUN:   |& grep {MayAlias:     double\\* \[%\]p.0.i.0, double\\* \[%\]p3\$}
3 ; PR4267
4
5 ; %p3 is equal to %p.0.i.0 on the second iteration of the loop,
6 ; so MayAlias is needed.
7
8 define void @foo([3 x [3 x double]]* noalias %p) {
9 entry:
10   %p3 = getelementptr [3 x [3 x double]]* %p, i64 0, i64 0, i64 3
11   br label %loop
12
13 loop:
14   %i = phi i64 [ 0, %entry ], [ %i.next, %loop ]
15
16   %p.0.i.0 = getelementptr [3 x [3 x double]]* %p, i64 0, i64 %i, i64 0
17
18   volatile store double 0.0, double* %p3
19   volatile store double 0.1, double* %p.0.i.0
20
21   %i.next = add i64 %i, 1
22   %cmp = icmp slt i64 %i.next, 3
23   br i1 %cmp, label %loop, label %exit
24
25 exit:
26   ret void
27 }