1 ; RUN: opt -passes='print<access-info>' -aa-pipeline='basic-aa' -disable-output < %s 2>&1 | FileCheck %s
3 ; If the arrays don't alias this loop is safe with no memchecks:
4 ; for (i = 0; i < n; i++)
5 ; A[i] = A[i] * B[i] * C[i];
7 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
8 target triple = "x86_64-apple-macosx10.10.0"
10 ; Check the loop-carried forward anti-dep between the load of A[i+1] and the
13 ; CHECK: Memory dependences are safe{{$}}
14 ; CHECK-NEXT: Dependences:
15 ; CHECK-NEXT: Forward:
16 ; CHECK-NEXT: %loadA_plus_2 = load i16, ptr %arrayidxA_plus_2, align 2 ->
17 ; CHECK-NEXT: store i16 %mul1, ptr %arrayidxA, align 2
20 define void @f(ptr noalias %a,
26 for.body: ; preds = %for.body, %entry
27 %ind = phi i64 [ 0, %entry ], [ %add, %for.body ]
29 %add = add nuw nsw i64 %ind, 1
31 %arrayidxA_plus_2 = getelementptr inbounds i16, ptr %a, i64 %add
32 %loadA_plus_2 = load i16, ptr %arrayidxA_plus_2, align 2
34 %arrayidxB = getelementptr inbounds i16, ptr %b, i64 %ind
35 %loadB = load i16, ptr %arrayidxB, align 2
37 %arrayidxC = getelementptr inbounds i16, ptr %c, i64 %ind
38 %loadC = load i16, ptr %arrayidxC, align 2
40 %mul = mul i16 %loadB, %loadA_plus_2
41 %mul1 = mul i16 %mul, %loadC
43 %arrayidxA = getelementptr inbounds i16, ptr %a, i64 %ind
44 store i16 %mul1, ptr %arrayidxA, align 2
46 %exitcond = icmp eq i64 %add, 20
47 br i1 %exitcond, label %for.end, label %for.body
49 for.end: ; preds = %for.body