1971bc46fSRoman Lebedev; RUN: opt -passes=loop-load-elim -S < %s | FileCheck %s 2cee313d2SEric Christopher 3cee313d2SEric Christophertarget datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" 4cee313d2SEric Christopher 5cee313d2SEric Christopher; Give up in the presence of unknown deps. Here, the different strides result 6cee313d2SEric Christopher; in unknown dependence: 7cee313d2SEric Christopher; 8cee313d2SEric Christopher; for (unsigned i = 0; i < 100; i++) { 9cee313d2SEric Christopher; A[i+1] = B[i] + 2; 10cee313d2SEric Christopher; A[2*i] = C[i] + 2; 11cee313d2SEric Christopher; D[i] = A[i] + 2; 12cee313d2SEric Christopher; } 13cee313d2SEric Christopher 14*055fb779SNikita Popovdefine void @f(ptr noalias %A, ptr noalias %B, ptr noalias %C, 15*055fb779SNikita Popov ptr noalias %D, i64 %N) { 16cee313d2SEric Christopher 17cee313d2SEric Christopherentry: 18cee313d2SEric Christopher; for.body.ph: 19cee313d2SEric Christopher; CHECK-NOT: %load_initial = 20cee313d2SEric Christopher br label %for.body 21cee313d2SEric Christopher 22cee313d2SEric Christopherfor.body: ; preds = %for.body, %entry 23cee313d2SEric Christopher; CHECK-NOT: %store_forwarded = 24cee313d2SEric Christopher %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ] 25cee313d2SEric Christopher %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 26cee313d2SEric Christopher 27*055fb779SNikita Popov %Aidx_next = getelementptr inbounds i32, ptr %A, i64 %indvars.iv.next 28*055fb779SNikita Popov %Bidx = getelementptr inbounds i32, ptr %B, i64 %indvars.iv 29*055fb779SNikita Popov %Cidx = getelementptr inbounds i32, ptr %C, i64 %indvars.iv 30*055fb779SNikita Popov %Didx = getelementptr inbounds i32, ptr %D, i64 %indvars.iv 31*055fb779SNikita Popov %Aidx = getelementptr inbounds i32, ptr %A, i64 %indvars.iv 32cee313d2SEric Christopher %indvars.m2 = mul nuw nsw i64 %indvars.iv, 2 33*055fb779SNikita Popov %A2idx = getelementptr inbounds i32, ptr %A, i64 %indvars.m2 34cee313d2SEric Christopher 35*055fb779SNikita Popov %b = load i32, ptr %Bidx, align 4 36cee313d2SEric Christopher %a_p1 = add i32 %b, 2 37*055fb779SNikita Popov store i32 %a_p1, ptr %Aidx_next, align 4 38cee313d2SEric Christopher 39*055fb779SNikita Popov %c = load i32, ptr %Cidx, align 4 40cee313d2SEric Christopher %a_m2 = add i32 %c, 2 41*055fb779SNikita Popov store i32 %a_m2, ptr %A2idx, align 4 42cee313d2SEric Christopher 43*055fb779SNikita Popov %a = load i32, ptr %Aidx, align 4 44cee313d2SEric Christopher; CHECK-NOT: %d = add i32 %store_forwarded, 2 45cee313d2SEric Christopher; CHECK: %d = add i32 %a, 2 46cee313d2SEric Christopher %d = add i32 %a, 2 47*055fb779SNikita Popov store i32 %d, ptr %Didx, align 4 48cee313d2SEric Christopher 49cee313d2SEric Christopher %exitcond = icmp eq i64 %indvars.iv.next, %N 50cee313d2SEric Christopher br i1 %exitcond, label %for.end, label %for.body 51cee313d2SEric Christopher 52cee313d2SEric Christopherfor.end: ; preds = %for.body 53cee313d2SEric Christopher ret void 54cee313d2SEric Christopher} 55