From 67f92622b1e219d39a3dc9140eeefcbae1574b1e Mon Sep 17 00:00:00 2001 From: Manoj Gupta Date: Mon, 18 Sep 2017 17:28:15 +0000 Subject: [PATCH] [LoopVectorizer] Add more testcases for PR33804. Summary: Add test cases when float <-> pointer types conversion is triggered in presence of load instructions. Reviewers: Ayal, srhines, mkuper, rengolin Reviewed By: rengolin Subscribers: javed.absar, llvm-commits Differential Revision: https://reviews.llvm.org/D37967 llvm-svn: 313544 --- .../AArch64/loopvectorize_pr33804_double.ll | 48 +++++++++++++++++++ test/CodeGen/ARM/loopvectorize_pr33804.ll | 48 +++++++++++++++++++ 2 files changed, 96 insertions(+) diff --git a/test/CodeGen/AArch64/loopvectorize_pr33804_double.ll b/test/CodeGen/AArch64/loopvectorize_pr33804_double.ll index 7468784f38d..c18fc0cb803 100644 --- a/test/CodeGen/AArch64/loopvectorize_pr33804_double.ll +++ b/test/CodeGen/AArch64/loopvectorize_pr33804_double.ll @@ -60,6 +60,54 @@ for.end22.i.i: ; preds = %for.body14.i.i unreachable } +; This test check for integer to pointer casting with load instructions. + +; CHECK-LABEL: @cvCalcEMD3 +; CHECK: vector.body +; CHECK: inttoptr <{{[0-9]+}} x i64> +define void @cvCalcEMD3() local_unnamed_addr #0 personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { +entry: + br label %for.body14.i.i + +for.body14.i.i: ; preds = %for.body14.i.i, %entry + %i.1424.i.i = phi i32 [ %inc21.i.i, %for.body14.i.i ], [ 0, %entry ] + %arrayidx15.i.i1427 = getelementptr inbounds %struct.CvNode1D, %struct.CvNode1D* undef, i32 %i.1424.i.i + %val.i.i = getelementptr inbounds %struct.CvNode1D, %struct.CvNode1D* %arrayidx15.i.i1427, i32 0, i32 0 + %load_d = load double, double* %val.i.i, align 4 + %next19.i.i = getelementptr inbounds %struct.CvNode1D, %struct.CvNode1D* undef, i32 %i.1424.i.i, i32 1 + %load_p = load %struct.CvNode1D*, %struct.CvNode1D** %next19.i.i, align 4 + %inc21.i.i = add nuw nsw i32 %i.1424.i.i, 1 + %exitcond438.i.i = icmp eq i32 %inc21.i.i, 0 + br i1 %exitcond438.i.i, label %for.end22.i.i, label %for.body14.i.i + +for.end22.i.i: ; preds = %for.body14.i.i + unreachable +} + +; This test check for pointer to integer casting with load instructions. + +; CHECK-LABEL: @cvCalcEMD3_2 +; CHECK: vector.body +; CHECK: ptrtoint <{{[0-9]+}} x %struct.CvNode1D2*> +define void @cvCalcEMD3_2() local_unnamed_addr #0 personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { +entry: + br label %for.body14.i.i + +for.body14.i.i: ; preds = %for.body14.i.i, %entry + %i.1424.i.i = phi i32 [ %inc21.i.i, %for.body14.i.i ], [ 0, %entry ] + %next19.i.i = getelementptr inbounds %struct.CvNode1D2, %struct.CvNode1D2* undef, i32 %i.1424.i.i, i32 0 + %load_p = load %struct.CvNode1D2*, %struct.CvNode1D2** %next19.i.i, align 4 + %arrayidx15.i.i1427 = getelementptr inbounds %struct.CvNode1D2, %struct.CvNode1D2* undef, i32 %i.1424.i.i + %val.i.i = getelementptr inbounds %struct.CvNode1D2, %struct.CvNode1D2* %arrayidx15.i.i1427, i32 0, i32 1 + %load_d = load double, double* %val.i.i, align 4 + %inc21.i.i = add nuw nsw i32 %i.1424.i.i, 1 + %exitcond438.i.i = icmp eq i32 %inc21.i.i, 0 + br i1 %exitcond438.i.i, label %for.end22.i.i, label %for.body14.i.i + +for.end22.i.i: ; preds = %for.body14.i.i + unreachable +} + declare i32 @__gxx_personality_v0(...) attributes #0 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="generic" "unsafe-fp-math"="false" "use-soft-float"="false" } diff --git a/test/CodeGen/ARM/loopvectorize_pr33804.ll b/test/CodeGen/ARM/loopvectorize_pr33804.ll index a218af3306d..d197a3757b2 100644 --- a/test/CodeGen/ARM/loopvectorize_pr33804.ll +++ b/test/CodeGen/ARM/loopvectorize_pr33804.ll @@ -60,6 +60,54 @@ for.end22.i.i: ; preds = %for.body14.i.i unreachable } +; This test checks for the intoptr conversions with load instructions. + +; CHECK-LABEL: @cvCalcEMD3 +; CHECK: vector.body +; CHECK: inttoptr <{{[0-9]+}} x i32> +define void @cvCalcEMD3() local_unnamed_addr #0 personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { +entry: + br label %for.body14.i.i + +for.body14.i.i: ; preds = %for.body14.i.i, %entry + %i.1424.i.i = phi i32 [ %inc21.i.i, %for.body14.i.i ], [ 0, %entry ] + %arrayidx15.i.i1427 = getelementptr inbounds %struct.CvNode1D, %struct.CvNode1D* undef, i32 %i.1424.i.i + %val.i.i = getelementptr inbounds %struct.CvNode1D, %struct.CvNode1D* %arrayidx15.i.i1427, i32 0, i32 0 + %loadf = load float, float* %val.i.i, align 4 + %next19.i.i = getelementptr inbounds %struct.CvNode1D, %struct.CvNode1D* undef, i32 %i.1424.i.i, i32 1 + %loadp = load %struct.CvNode1D*, %struct.CvNode1D** %next19.i.i, align 4 + %inc21.i.i = add nuw nsw i32 %i.1424.i.i, 1 + %exitcond438.i.i = icmp eq i32 %inc21.i.i, 0 + br i1 %exitcond438.i.i, label %for.end22.i.i, label %for.body14.i.i + +for.end22.i.i: ; preds = %for.body14.i.i + unreachable +} + +; This test checks for ptrtoint conversions with load instructions. + +; CHECK-LABEL: @cvCalcEMD3_2 +; CHECK: vector.body +; CHECK: ptrtoint <{{[0-9]+}} x %struct.CvNode1D2*> +define void @cvCalcEMD3_2() local_unnamed_addr #0 personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { +entry: + br label %for.body14.i.i + +for.body14.i.i: ; preds = %for.body14.i.i, %entry + %i.1424.i.i = phi i32 [ %inc21.i.i, %for.body14.i.i ], [ 0, %entry ] + %next19.i.i = getelementptr inbounds %struct.CvNode1D2, %struct.CvNode1D2* undef, i32 %i.1424.i.i, i32 0 + %loadp = load %struct.CvNode1D2*, %struct.CvNode1D2** %next19.i.i, align 4 + %arrayidx15.i.i1427 = getelementptr inbounds %struct.CvNode1D2, %struct.CvNode1D2* undef, i32 %i.1424.i.i + %val.i.i = getelementptr inbounds %struct.CvNode1D2, %struct.CvNode1D2* %arrayidx15.i.i1427, i32 0, i32 1 + %loadf = load float, float* %val.i.i, align 4 + %inc21.i.i = add nuw nsw i32 %i.1424.i.i, 1 + %exitcond438.i.i = icmp eq i32 %inc21.i.i, 0 + br i1 %exitcond438.i.i, label %for.end22.i.i, label %for.body14.i.i + +for.end22.i.i: ; preds = %for.body14.i.i + unreachable +} + declare i32 @__gxx_personality_v0(...) attributes #0 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="generic" "target-features"="+dsp,+neon,+vfp3,-thumb-mode" "unsafe-fp-math"="false" "use-soft-float"="false" }