53 lines · plain
1; RUN: opt -passes=loop-distribute,loop-vectorize -enable-loop-distribute -force-vector-width=4 \2; RUN: -verify-loop-info -verify-dom-info -S < %s | FileCheck %s3 4; If only A and B can alias here, we don't need memchecks to distribute since5; A and B are in the same partition. This used to cause a crash in the6; memcheck generation.7;8; for (i = 0; i < n; i++) {9; A[i + 1] = A[i] * B[i];10; ------------------------------11; C[i] = D[i] * E[i];12; }13 14define void @f(ptr %a, ptr %b, ptr noalias %c, ptr noalias %d, ptr noalias %e) {15; CHECK-LABEL: @f(16; CHECK-NOT: memcheck:17; CHECK: mul <4 x i32>18entry:19 br label %for.body20 21for.body: ; preds = %for.body, %entry22 %ind = phi i64 [ 0, %entry ], [ %add, %for.body ]23 24 %arrayidxA = getelementptr inbounds i32, ptr %a, i64 %ind25 %loadA = load i32, ptr %arrayidxA, align 426 27 %arrayidxB = getelementptr inbounds i32, ptr %b, i64 %ind28 %loadB = load i32, ptr %arrayidxB, align 429 30 %mulA = mul i32 %loadB, %loadA31 32 %add = add nuw nsw i64 %ind, 133 %arrayidxA_plus_4 = getelementptr inbounds i32, ptr %a, i64 %add34 store i32 %mulA, ptr %arrayidxA_plus_4, align 435 36 %arrayidxD = getelementptr inbounds i32, ptr %d, i64 %ind37 %loadD = load i32, ptr %arrayidxD, align 438 39 %arrayidxE = getelementptr inbounds i32, ptr %e, i64 %ind40 %loadE = load i32, ptr %arrayidxE, align 441 42 %mulC = mul i32 %loadD, %loadE43 44 %arrayidxC = getelementptr inbounds i32, ptr %c, i64 %ind45 store i32 %mulC, ptr %arrayidxC, align 446 47 %exitcond = icmp eq i64 %add, 2048 br i1 %exitcond, label %for.end, label %for.body49 50for.end: ; preds = %for.body51 ret void52}53