[PATCH] [PATCH] Fix a bug about memory dependence checking in loop vectorization
Hao Liu
Hao.Liu at arm.com
Sun Jan 4 23:50:07 PST 2015
Hi Jiangning,
I think the test case can be simplified so that we can understand the problem easily. I've simplified it into
define void @test_loop_novect(double** %Array_.i, i64 %indvars.iv1438) {
for.body209.lr.ph:
%t275 = load double** %Array_.i, align 8
br label %for.body209
for.body209: ; preds = %for.body209, %for.body209.lr.ph
%indvars.iv1436 = phi i64 [ 0, %for.body209.lr.ph ], [ %indvars.iv.next1437, %for.body209 ]
%arrayidx.i954 = getelementptr inbounds double* %t275, i64 %indvars.iv1436
%indvars.iv.next1437 = add nuw nsw i64 %indvars.iv1436, 1
%arrayidx.i997 = getelementptr inbounds double* %t275, i64 %indvars.iv.next1437
%t282 = load double* %arrayidx.i954, align 8
%t284 = load double* %arrayidx.i997, align 8
store double %t282, double* %arrayidx.i997, align 8
store double %t284, double* %arrayidx.i954, align 8
%exitcond1441 = icmp eq i64 %indvars.iv1436, %indvars.iv1438
br i1 %exitcond1441, label %invoke.cont239, label %for.body209
invoke.cont239: ; preds = %for.body209
ret void
}
Then it's easier to know that the case is like
tmp1 = a[i]
tmp2 = a[i+1]
a[i+1] = tmp1
a[i] = tmp2
Besides that, I think the fix itself is reasonable and LGTM.
REPOSITORY
rL LLVM
http://reviews.llvm.org/D6735
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the llvm-commits
mailing list