1 ; RUN: opt -basic-aa -loop-load-elim -S < %s | FileCheck %s
3 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
5 ; Give up in the presence of unknown deps. Here, the different strides result
6 ; in unknown dependence:
8 ; for (unsigned i = 0; i < 100; i++) {
14 define void @f(i32* noalias %A, i32* noalias %B, i32* noalias %C,
15 i32* noalias %D, i64 %N) {
19 ; CHECK-NOT: %load_initial =
22 for.body: ; preds = %for.body, %entry
23 ; 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, 1
27 %Aidx_next = getelementptr inbounds i32, i32* %A, i64 %indvars.iv.next
28 %Bidx = getelementptr inbounds i32, i32* %B, i64 %indvars.iv
29 %Cidx = getelementptr inbounds i32, i32* %C, i64 %indvars.iv
30 %Didx = getelementptr inbounds i32, i32* %D, i64 %indvars.iv
31 %Aidx = getelementptr inbounds i32, i32* %A, i64 %indvars.iv
32 %indvars.m2 = mul nuw nsw i64 %indvars.iv, 2
33 %A2idx = getelementptr inbounds i32, i32* %A, i64 %indvars.m2
35 %b = load i32, i32* %Bidx, align 4
37 store i32 %a_p1, i32* %Aidx_next, align 4
39 %c = load i32, i32* %Cidx, align 4
41 store i32 %a_m2, i32* %A2idx, align 4
43 %a = load i32, i32* %Aidx, align 4
44 ; CHECK-NOT: %d = add i32 %store_forwarded, 2
45 ; CHECK: %d = add i32 %a, 2
47 store i32 %d, i32* %Didx, align 4
49 %exitcond = icmp eq i64 %indvars.iv.next, %N
50 br i1 %exitcond, label %for.end, label %for.body
52 for.end: ; preds = %for.body