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