• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt < %s -basicaa -aa-eval -print-all-alias-modref-info -disable-output \
2; RUN:   |& grep {NoAlias:	double\\* \[%\]a, double\\* \[%\]b\$} | count 4
3
4; BasicAA should detect NoAliases in PHIs and Selects.
5
6; Two PHIs in the same block.
7define void @foo(i1 %m, double* noalias %x, double* noalias %y) {
8entry:
9  br i1 %m, label %true, label %false
10
11true:
12  br label %exit
13
14false:
15  br label %exit
16
17exit:
18  %a = phi double* [ %x, %true ], [ %y, %false ]
19  %b = phi double* [ %x, %false ], [ %y, %true ]
20  volatile store double 0.0, double* %a
21  volatile store double 1.0, double* %b
22  ret void
23}
24
25; Two selects with the same condition.
26define void @bar(i1 %m, double* noalias %x, double* noalias %y) {
27entry:
28  %a = select i1 %m, double* %x, double* %y
29  %b = select i1 %m, double* %y, double* %x
30  volatile store double 0.000000e+00, double* %a
31  volatile store double 1.000000e+00, double* %b
32  ret void
33}
34
35; Two PHIs with disjoint sets of inputs.
36define void @qux(i1 %m, double* noalias %x, double* noalias %y,
37                 i1 %n, double* noalias %v, double* noalias %w) {
38entry:
39  br i1 %m, label %true, label %false
40
41true:
42  br label %exit
43
44false:
45  br label %exit
46
47exit:
48  %a = phi double* [ %x, %true ], [ %y, %false ]
49  br i1 %n, label %ntrue, label %nfalse
50
51ntrue:
52  br label %nexit
53
54nfalse:
55  br label %nexit
56
57nexit:
58  %b = phi double* [ %v, %ntrue ], [ %w, %nfalse ]
59  volatile store double 0.0, double* %a
60  volatile store double 1.0, double* %b
61  ret void
62}
63
64; Two selects with disjoint sets of arms.
65define void @fin(i1 %m, double* noalias %x, double* noalias %y,
66                 i1 %n, double* noalias %v, double* noalias %w) {
67entry:
68  %a = select i1 %m, double* %x, double* %y
69  %b = select i1 %n, double* %v, double* %w
70  volatile store double 0.000000e+00, double* %a
71  volatile store double 1.000000e+00, double* %b
72  ret void
73}
74