1 ; RUN: opt < %s -disable-output "-passes=print<da>" \
2 ; RUN: "-aa-pipeline=basic-aa,type-based-aa" 2>&1 | FileCheck %s
3 ; RUN: opt < %s -analyze -basicaa -tbaa -da | FileCheck %s
5 ; CHECK-LABEL: 'Dependence Analysis' for function 'test_no_noalias'
6 ; CHECK: da analyze - none!
7 ; CHECK: da analyze - confused!
8 ; CHECK: da analyze - none!
9 define void @test_no_noalias(i32* %A, i32* %B) {
15 ; CHECK-LABEL: test_one_noalias
16 ; CHECK: da analyze - none!
17 ; CHECK: da analyze - none!
18 ; CHECK: da analyze - none!
19 define void @test_one_noalias(i32* noalias %A, i32* %B) {
25 ; CHECK-LABEL: test_two_noalias
26 ; CHECK: da analyze - none!
27 ; CHECK: da analyze - none!
28 ; CHECK: da analyze - none!
29 define void @test_two_noalias(i32* noalias %A, i32* noalias %B) {
35 ; CHECK-LABEL: test_global_alias
36 ; CHECK: da analyze - none!
37 ; CHECK: da analyze - confused!
38 ; CHECK: da analyze - none!
40 define void @test_global_alias(i32* %A) {
46 ; CHECK-LABEL: test_global_noalias
47 ; CHECK: da analyze - none!
48 ; CHECK: da analyze - none!
49 ; CHECK: da analyze - none!
50 define void @test_global_noalias(i32* noalias %A) {
56 ; CHECK-LABEL: test_global_size
57 ; CHECK: da analyze - none!
58 ; CHECK: da analyze - confused!
59 ; CHECK: da analyze - none!
60 ; CHECK: da analyze - none!
61 ; CHECK: da analyze - confused!
62 ; CHECK: da analyze - none!
64 @a = global i16 5, align 2
65 @b = global i16* @a, align 4
66 define void @test_global_size() {
67 %l0 = load i16*, i16** @b, align 4
68 %l1 = load i16, i16* %l0, align 2
69 store i16 1, i16* @a, align 2
73 ; CHECK-LABEL: test_tbaa_same
74 ; CHECK: da analyze - none!
75 ; CHECK: da analyze - confused!
76 ; CHECK: da analyze - none!
77 define void @test_tbaa_same(i32* %A, i32* %B) {
78 store i32 1, i32* %A, !tbaa !5
79 store i32 2, i32* %B, !tbaa !5
83 ; CHECK-LABEL: test_tbaa_diff
84 ; CHECK: da analyze - none!
85 ; CHECK: da analyze - none!
86 ; CHECK: da analyze - none!
87 define void @test_tbaa_diff(i32* %A, i16* %B) {
88 store i32 1, i32* %A, !tbaa !5
89 store i16 2, i16* %B, !tbaa !9
93 ; CHECK-LABEL: tbaa_loop
94 ; CHECK: da analyze - input
95 ; CHECK: da analyze - none
96 ; CHECK: da analyze - output
97 define void @tbaa_loop(i32 %I, i32 %J, i32* nocapture %A, i16* nocapture readonly %B) {
99 %cmp = icmp ne i32 %J, 0
100 %cmp122 = icmp ne i32 %I, 0
101 %or.cond = and i1 %cmp, %cmp122
102 br i1 %or.cond, label %for.outer.preheader, label %for.end
108 %i.us = phi i32 [ %add8.us, %for.latch ], [ 0, %for.outer.preheader ]
112 %j.us = phi i32 [ 0, %for.outer ], [ %inc.us, %for.inner ]
113 %sum1.us = phi i32 [ 0, %for.outer ], [ %add.us, %for.inner ]
114 %arrayidx.us = getelementptr inbounds i16, i16* %B, i32 %j.us
115 %0 = load i16, i16* %arrayidx.us, align 4, !tbaa !9
116 %sext = sext i16 %0 to i32
117 %add.us = add i32 %sext, %sum1.us
118 %inc.us = add nuw i32 %j.us, 1
119 %exitcond = icmp eq i32 %inc.us, %J
120 br i1 %exitcond, label %for.latch, label %for.inner
123 %add.us.lcssa = phi i32 [ %add.us, %for.inner ]
124 %arrayidx6.us = getelementptr inbounds i32, i32* %A, i32 %i.us
125 store i32 %add.us.lcssa, i32* %arrayidx6.us, align 4, !tbaa !5
126 %add8.us = add nuw i32 %i.us, 1
127 %exitcond25 = icmp eq i32 %add8.us, %I
128 br i1 %exitcond25, label %for.end.loopexit, label %for.outer
137 !5 = !{!6, !6, i64 0}
138 !6 = !{!"int", !7, i64 0}
139 !7 = !{!"omnipotent char", !8, i64 0}
140 !8 = !{!"Simple C/C++ TBAA"}
141 !9 = !{!10, !10, i64 0}
142 !10 = !{!"short", !7, i64 0}