1 ; RUN: opt -passes='print<access-info>' -disable-output < %s 2>&1 | FileCheck %s
3 ; Check that loop-indepedent forward dependences are discovered properly.
5 ; FIXME: This does not actually always work which is pretty confusing. Right
6 ; now there is hack in LAA that tries to figure out loop-indepedent forward
7 ; dependeces *outside* of the MemoryDepChecker logic (i.e. proper dependence
10 ; Therefore if there is only loop-independent dependences for an array
11 ; (i.e. the same index is used), we don't discover the forward dependence.
12 ; So, at ***, we add another non-I-based access of A to trigger
13 ; MemoryDepChecker analysis for accesses of A.
15 ; for (unsigned i = 0; i < 100; i++) {
16 ; A[i + 1] = B[i] + 1; // ***
21 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
23 define void @f(ptr noalias %A, ptr noalias %B, ptr noalias %C, i64 %N) {
26 ; CHECK-NEXT: Forward:
27 ; CHECK-NEXT: store i32 %b_p1, ptr %Aidx, align 4 ->
28 ; CHECK-NEXT: %a = load i32, ptr %Aidx, align 4
29 ; CHECK: ForwardButPreventsForwarding:
30 ; CHECK-NEXT: store i32 %b_p2, ptr %Aidx_next, align 4 ->
31 ; CHECK-NEXT: %a = load i32, ptr %Aidx, align 4
33 ; CHECK-NEXT: store i32 %b_p2, ptr %Aidx_next, align 4 ->
34 ; CHECK-NEXT: store i32 %b_p1, ptr %Aidx, align 4
39 for.body: ; preds = %for.body, %entry
40 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
41 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
43 %Bidx = getelementptr inbounds i32, ptr %B, i64 %indvars.iv
44 %Cidx = getelementptr inbounds i32, ptr %C, i64 %indvars.iv
45 %Aidx_next = getelementptr inbounds i32, ptr %A, i64 %indvars.iv.next
46 %Aidx = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
48 %b = load i32, ptr %Bidx, align 4
50 store i32 %b_p2, ptr %Aidx_next, align 4
53 store i32 %b_p1, ptr %Aidx, align 4
55 %a = load i32, ptr %Aidx, align 4
57 store i32 %c, ptr %Cidx, align 4
59 %exitcond = icmp eq i64 %indvars.iv.next, %N
60 br i1 %exitcond, label %for.end, label %for.body
62 for.end: ; preds = %for.body