80 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 42; RUN: opt -passes='print<access-info>' -disable-output < %s 2>&1 | FileCheck %s3 4; Check that loop-independent forward dependences are discovered properly.5;6; FIXME: This does not actually always work which is pretty confusing. Right7; now there is hack in LAA that tries to figure out loop-independent forward8; dependeces *outside* of the MemoryDepChecker logic (i.e. proper dependence9; analysis).10;11; Therefore if there is only loop-independent dependences for an array12; (i.e. the same index is used), we don't discover the forward dependence.13; So, at ***, we add another non-I-based access of A to trigger14; MemoryDepChecker analysis for accesses of A.15;16; for (unsigned i = 0; i < 100; i++) {17; A[i + 1] = B[i] + 1; // ***18; A[i] = B[i] + 2;19; C[i] = A[i] * 2;20; }21 22target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"23 24define void @f(ptr noalias %A, ptr noalias %B, ptr noalias %C, i64 %N) {25; CHECK-LABEL: 'f'26; CHECK-NEXT: for.body:27; CHECK-NEXT: Report: unsafe dependent memory operations in loop. Use #pragma clang loop distribute(enable) to allow loop distribution to attempt to isolate the offending operations into a separate loop28; CHECK-NEXT: Forward loop carried data dependence that prevents store-to-load forwarding.29; CHECK-NEXT: Dependences:30; CHECK-NEXT: Forward:31; CHECK-NEXT: store i32 %b_p1, ptr %Aidx, align 4 ->32; CHECK-NEXT: %a = load i32, ptr %Aidx, align 433; CHECK-EMPTY:34; CHECK-NEXT: ForwardButPreventsForwarding:35; CHECK-NEXT: store i32 %b_p2, ptr %Aidx_next, align 4 ->36; CHECK-NEXT: %a = load i32, ptr %Aidx, align 437; CHECK-EMPTY:38; CHECK-NEXT: Forward:39; CHECK-NEXT: store i32 %b_p2, ptr %Aidx_next, align 4 ->40; CHECK-NEXT: store i32 %b_p1, ptr %Aidx, align 441; CHECK-EMPTY:42; CHECK-NEXT: Run-time memory checks:43; CHECK-NEXT: Grouped accesses:44; CHECK-EMPTY:45; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.46; CHECK-NEXT: SCEV assumptions:47; CHECK-EMPTY:48; CHECK-NEXT: Expressions re-written:49;50 51entry:52 br label %for.body53 54for.body: ; preds = %for.body, %entry55 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]56 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 157 58 %Bidx = getelementptr inbounds i32, ptr %B, i64 %indvars.iv59 %Cidx = getelementptr inbounds i32, ptr %C, i64 %indvars.iv60 %Aidx_next = getelementptr inbounds i32, ptr %A, i64 %indvars.iv.next61 %Aidx = getelementptr inbounds i32, ptr %A, i64 %indvars.iv62 63 %b = load i32, ptr %Bidx, align 464 %b_p2 = add i32 %b, 165 store i32 %b_p2, ptr %Aidx_next, align 466 67 %b_p1 = add i32 %b, 268 store i32 %b_p1, ptr %Aidx, align 469 70 %a = load i32, ptr %Aidx, align 471 %c = mul i32 %a, 272 store i32 %c, ptr %Cidx, align 473 74 %exitcond = icmp eq i64 %indvars.iv.next, %N75 br i1 %exitcond, label %for.end, label %for.body76 77for.end: ; preds = %for.body78 ret void79}80