brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.7 KiB · 9a8f479 Raw
55 lines · plain
1; RUN: opt -passes=loop-load-elim -S < %s | FileCheck %s2 3target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"4 5; Give up in the presence of unknown deps. Here, the different strides result6; in unknown dependence:7;8;   for (unsigned i = 0; i < 100; i++) {9;     A[i+1] = B[i] + 2;10;     A[2*i] = C[i] + 2;11;     D[i] = A[i] + 2;12;   }13 14define void @f(ptr noalias %A, ptr noalias %B, ptr noalias %C,15               ptr noalias %D, i64 %N) {16 17entry:18; for.body.ph:19; CHECK-NOT: %load_initial =20  br label %for.body21 22for.body:                                         ; preds = %for.body, %entry23; CHECK-NOT: %store_forwarded =24  %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]25  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 126 27  %Aidx_next = getelementptr inbounds i32, ptr %A, i64 %indvars.iv.next28  %Bidx = getelementptr inbounds i32, ptr %B, i64 %indvars.iv29  %Cidx = getelementptr inbounds i32, ptr %C, i64 %indvars.iv30  %Didx = getelementptr inbounds i32, ptr %D, i64 %indvars.iv31  %Aidx = getelementptr inbounds i32, ptr %A, i64 %indvars.iv32  %indvars.m2 = mul nuw nsw i64 %indvars.iv, 233  %A2idx = getelementptr inbounds i32, ptr %A, i64 %indvars.m234 35  %b = load i32, ptr %Bidx, align 436  %a_p1 = add i32 %b, 237  store i32 %a_p1, ptr %Aidx_next, align 438 39  %c = load i32, ptr %Cidx, align 440  %a_m2 = add i32 %c, 241  store i32 %a_m2, ptr %A2idx, align 442 43  %a = load i32, ptr %Aidx, align 444; CHECK-NOT: %d = add i32 %store_forwarded, 245; CHECK: %d = add i32 %a, 246  %d = add i32 %a, 247  store i32 %d, ptr %Didx, align 448 49  %exitcond = icmp eq i64 %indvars.iv.next, %N50  br i1 %exitcond, label %for.end, label %for.body51 52for.end:                                          ; preds = %for.body53  ret void54}55