1 ; RUN: opt -passes='print<access-info>' -aa-pipeline='basic-aa' -disable-output < %s 2>&1 | FileCheck %s
3 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
4 target triple = "x86_64-apple-macosx10.10.0"
6 ; TODO: Loop iteration counts are only required if we generate memory
7 ; runtime checks. Missing iteration counts should not prevent
8 ; analysis, if no runtime checks are required.
10 ; No memory checks are required, because base pointers do not alias and we have
11 ; a forward dependence for %a.
12 define void @safe_forward_dependence(ptr noalias %a,
14 ; CHECK-LABEL: safe_forward_dependence
16 ; CHECK-NEXT: Report: could not determine number of loop iterations
21 for.body: ; preds = %for.body, %entry
22 %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
24 %iv.next = add nuw nsw i64 %iv, 1
26 %arrayidxA_plus_2 = getelementptr inbounds i16, ptr %a, i64 %iv.next
27 %loadA_plus_2 = load i16, ptr %arrayidxA_plus_2, align 2
29 %arrayidxB = getelementptr inbounds i16, ptr %b, i64 %iv
30 %loadB = load i16, ptr %arrayidxB, align 2
33 %mul = mul i16 %loadB, %loadA_plus_2
35 %arrayidxA = getelementptr inbounds i16, ptr %a, i64 %iv
36 store i16 %mul, ptr %arrayidxA, align 2
38 %exitcond = icmp eq i16 %loadB, 20
39 br i1 %exitcond, label %for.end, label %for.body
41 for.end: ; preds = %for.body
48 define void @unsafe_backwards_dependence(ptr noalias %a,
50 ; CHECK-LABEL: unsafe_backwards_dependence
52 ; CHECK-NEXT: Report: could not determine number of loop iterations
57 for.body: ; preds = %for.body, %entry
58 %iv = phi i64 [ 1, %entry ], [ %iv.next, %for.body ]
60 %idx = add nuw nsw i64 %iv, -1
61 %iv.next = add nuw nsw i64 %iv, 1
63 %arrayidxA_plus_2 = getelementptr inbounds i16, ptr %a, i64 %idx
64 %loadA_plus_2 = load i16, ptr %arrayidxA_plus_2, align 2
66 %arrayidxB = getelementptr inbounds i16, ptr %b, i64 %iv
67 %loadB = load i16, ptr %arrayidxB, align 2
70 %mul = mul i16 %loadB, %loadA_plus_2
72 %arrayidxA = getelementptr inbounds i16, ptr %a, i64 %iv
73 store i16 %mul, ptr %arrayidxA, align 2
75 %exitcond = icmp eq i16 %loadB, 20
76 br i1 %exitcond, label %for.end, label %for.body
78 for.end: ; preds = %for.body
83 define void @ptr_may_alias(ptr %a, ptr %b) {
84 ; CHECK-LABEL: ptr_may_alias
86 ; CHECK-NEXT: Report: could not determine number of loop iterations
91 for.body: ; preds = %for.body, %entry
92 %iv = phi i64 [ 1, %entry ], [ %iv.next, %for.body ]
94 %idx = add nuw nsw i64 %iv, -1
95 %iv.next = add nuw nsw i64 %iv, 1
97 %arrayidxA = getelementptr inbounds i16, ptr %a, i64 %iv
98 %loadA = load i16, ptr %arrayidxA, align 2
100 %arrayidxB = getelementptr inbounds i16, ptr %b, i64 %iv
101 %loadB = load i16, ptr %arrayidxB, align 2
103 %mul = mul i16 %loadB, %loadA
105 store i16 %mul, ptr %arrayidxA, align 2
107 %exitcond = icmp eq i16 %loadB, 20
108 br i1 %exitcond, label %for.end, label %for.body
110 for.end: ; preds = %for.body