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