brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.6 KiB · fc00d68 Raw
52 lines · plain
1; RUN: opt -passes='print<access-info>' -aa-pipeline='basic-aa' -disable-output < %s  2>&1 | FileCheck %s2 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];6 7target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"8target triple = "x86_64-apple-macosx10.10.0"9 10; Check the loop-carried forward anti-dep between the load of A[i+1] and the11; store of A[i];12 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 218 19 20define void @f(ptr noalias %a,21               ptr noalias %b,22               ptr noalias %c) {23entry:24  br label %for.body25 26for.body:                                         ; preds = %for.body, %entry27  %ind = phi i64 [ 0, %entry ], [ %add, %for.body ]28 29  %add = add nuw nsw i64 %ind, 130 31  %arrayidxA_plus_2 = getelementptr inbounds i16, ptr %a, i64 %add32  %loadA_plus_2 = load i16, ptr %arrayidxA_plus_2, align 233 34  %arrayidxB = getelementptr inbounds i16, ptr %b, i64 %ind35  %loadB = load i16, ptr %arrayidxB, align 236 37  %arrayidxC = getelementptr inbounds i16, ptr %c, i64 %ind38  %loadC = load i16, ptr %arrayidxC, align 239 40  %mul = mul i16 %loadB, %loadA_plus_241  %mul1 = mul i16 %mul, %loadC42 43  %arrayidxA = getelementptr inbounds i16, ptr %a, i64 %ind44  store i16 %mul1, ptr %arrayidxA, align 245 46  %exitcond = icmp eq i64 %add, 2047  br i1 %exitcond, label %for.end, label %for.body48 49for.end:                                          ; preds = %for.body50  ret void51}52