1 ; RUN: opt -passes='print<access-info>' -disable-output < %s 2>&1 | FileCheck %s
3 ; We give up analyzing the dependences in this loop due to non-constant
4 ; distance between A[i+offset] and A[i] and add memchecks to prove
5 ; independence. Make sure that no dependences are reported in
8 ; for (i = 0; i < n; i++)
9 ; A[i + offset] = A[i] * B[i] * C[i];
11 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
12 target triple = "x86_64-apple-macosx10.10.0"
14 ; CHECK: Memory dependences are safe with run-time checks
15 ; CHECK-NEXT: Dependences:
16 ; CHECK-NEXT: Run-time memory checks:
18 ; CHECK-NEXT: Comparing group
19 ; CHECK-NEXT: %arrayidxA2 = getelementptr inbounds i16, ptr %a, i64 %idx
20 ; CHECK-NEXT: Against group
21 ; CHECK-NEXT: %arrayidxA = getelementptr inbounds i16, ptr %a, i64 %indvar
23 @B = common global ptr null, align 8
24 @A = common global ptr null, align 8
25 @C = common global ptr null, align 8
27 define void @f(i64 %offset) {
29 %a = load ptr, ptr @A, align 8
30 %b = load ptr, ptr @B, align 8
31 %c = load ptr, ptr @C, align 8
34 for.body: ; preds = %for.body, %entry
35 %indvar = phi i64 [ 0, %entry ], [ %add, %for.body ]
37 %arrayidxA = getelementptr inbounds i16, ptr %a, i64 %indvar
38 %loadA = load i16, ptr %arrayidxA, align 2
40 %arrayidxB = getelementptr inbounds i16, ptr %b, i64 %indvar
41 %loadB = load i16, ptr %arrayidxB, align 2
43 %arrayidxC = getelementptr inbounds i16, ptr %c, i64 %indvar
44 %loadC = load i16, ptr %arrayidxC, align 2
46 %mul = mul i16 %loadB, %loadA
47 %mul1 = mul i16 %mul, %loadC
49 %idx = add i64 %indvar, %offset
50 %arrayidxA2 = getelementptr inbounds i16, ptr %a, i64 %idx
51 store i16 %mul1, ptr %arrayidxA2, align 2
53 %add = add nuw nsw i64 %indvar, 1
54 %exitcond = icmp eq i64 %add, 20
55 br i1 %exitcond, label %for.end, label %for.body
57 for.end: ; preds = %for.body