1 ; RUN: opt -basicaa -loop-accesses -analyze < %s | 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+1] * 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: Memory dependences are safe{{$}}
12 define void @f(i16* noalias %a,
18 for.body: ; preds = %for.body, %entry
19 %ind = phi i64 [ 0, %entry ], [ %add, %for.body ]
21 %add = add nuw nsw i64 %ind, 1
23 %arrayidxA_plus_2 = getelementptr inbounds i16, i16* %a, i64 %add
24 %loadA_plus_2 = load i16, i16* %arrayidxA_plus_2, align 2
26 %arrayidxB = getelementptr inbounds i16, i16* %b, i64 %ind
27 %loadB = load i16, i16* %arrayidxB, align 2
29 %arrayidxC = getelementptr inbounds i16, i16* %c, i64 %ind
30 %loadC = load i16, i16* %arrayidxC, align 2
32 %mul = mul i16 %loadB, %loadA_plus_2
33 %mul1 = mul i16 %mul, %loadC
35 %arrayidxA = getelementptr inbounds i16, i16* %a, i64 %ind
36 store i16 %mul1, i16* %arrayidxA, align 2
38 %exitcond = icmp eq i64 %add, 20
39 br i1 %exitcond, label %for.end, label %for.body
41 for.end: ; preds = %for.body