116 lines · plain
1; RUN: opt -passes=loop-vectorize -S < %s | FileCheck %s2 3; These tests check that we don't crash if vectorizer decides to cast4; a float value to be stored into a pointer type or vice-versa.5 6; This test checks when a float value is stored into a pointer type.7 8; ModuleID = 'bugpoint-reduced-simplified.bc'9source_filename = "bugpoint-output-26dbd81.bc"10target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"11target triple = "armv7-unknown-linux-gnueabihf"12 13%struct.CvNode1D = type { float, ptr }14 15; CHECK-LABEL: @cvCalcEMD216; CHECK: vector.body17; CHECK: store <{{[0-9]+}} x ptr>18define void @cvCalcEMD2(ptr %dst) {19entry:20 br label %for.body14.i.i21 22for.body14.i.i: ; preds = %for.body14.i.i, %entry23 %i.1424.i.i = phi i32 [ %inc21.i.i, %for.body14.i.i ], [ 0, %entry ]24 %arrayidx15.i.i1427 = getelementptr inbounds %struct.CvNode1D, ptr %dst, i32 %i.1424.i.i25 store float 0xC415AF1D80000000, ptr %arrayidx15.i.i1427, align 426 %next19.i.i = getelementptr inbounds %struct.CvNode1D, ptr %dst, i32 %i.1424.i.i, i32 127 store ptr %dst, ptr %next19.i.i, align 428 %inc21.i.i = add nuw nsw i32 %i.1424.i.i, 129 %exitcond438.i.i = icmp eq i32 %inc21.i.i, 102430 br i1 %exitcond438.i.i, label %for.end22.i.i, label %for.body14.i.i31 32for.end22.i.i: ; preds = %for.body14.i.i33 unreachable34}35 36; This test checks when a pointer value is stored into a float type.37 38%struct.CvNode1D2 = type { ptr, float }39 40; CHECK-LABEL: @cvCalcEMD2_241; CHECK: vector.body42; CHECK: store <{{[0-9]+}} x float>43define void @cvCalcEMD2_2(ptr %dst) {44entry:45 br label %for.body14.i.i46 47for.body14.i.i: ; preds = %for.body14.i.i, %entry48 %i.1424.i.i = phi i32 [ %inc21.i.i, %for.body14.i.i ], [ 0, %entry ]49 %next19.i.i = getelementptr inbounds %struct.CvNode1D2, ptr %dst, i32 %i.1424.i.i, i32 050 store ptr %dst, ptr %next19.i.i, align 451 %arrayidx15.i.i1427 = getelementptr inbounds %struct.CvNode1D2, ptr %dst, i32 %i.1424.i.i52 %val.i.i = getelementptr inbounds %struct.CvNode1D2, ptr %arrayidx15.i.i1427, i32 0, i32 153 store float 0xC415AF1D80000000, ptr %val.i.i, align 454 %inc21.i.i = add nuw nsw i32 %i.1424.i.i, 155 %exitcond438.i.i = icmp eq i32 %inc21.i.i, 102456 br i1 %exitcond438.i.i, label %for.end22.i.i, label %for.body14.i.i57 58for.end22.i.i: ; preds = %for.body14.i.i59 unreachable60}61 62; This test checks for the intoptr conversions with load instructions.63 64; CHECK-LABEL: @cvCalcEMD365; CHECK: vector.body66; CHECK: inttoptr <{{[0-9]+}} x i32>67define void @cvCalcEMD3(ptr %src, ptr %dst) {68entry:69 br label %for.body14.i.i70 71for.body14.i.i: ; preds = %for.body14.i.i, %entry72 %i.1424.i.i = phi i32 [ %inc21.i.i, %for.body14.i.i ], [ 0, %entry ]73 %arrayidx15.i.i1427 = getelementptr inbounds %struct.CvNode1D, ptr %src, i32 %i.1424.i.i74 %loadf = load float, ptr %arrayidx15.i.i1427, align 475 %next19.i.i = getelementptr inbounds %struct.CvNode1D, ptr %src, i32 %i.1424.i.i, i32 176 %loadp = load ptr, ptr %next19.i.i, align 477 %dst.ptr = getelementptr inbounds %struct.CvNode1D, ptr %dst, i32 %i.1424.i.i78 %dst.ptr.1 = getelementptr inbounds %struct.CvNode1D, ptr %dst, i32 %i.1424.i.i, i32 179 store float %loadf, ptr %dst.ptr, align 480 store ptr %loadp, ptr %dst.ptr.1, align 481 %inc21.i.i = add nuw nsw i32 %i.1424.i.i, 182 %exitcond438.i.i = icmp eq i32 %inc21.i.i, 102483 br i1 %exitcond438.i.i, label %for.end22.i.i, label %for.body14.i.i84 85for.end22.i.i: ; preds = %for.body14.i.i86 unreachable87}88 89; This test checks for ptrtoint conversions with load instructions.90 91; CHECK-LABEL: @cvCalcEMD3_292; CHECK: vector.body93; CHECK: ptrtoint <{{[0-9]+}} x ptr>94define void @cvCalcEMD3_2(ptr %src, ptr %dst) {95entry:96 br label %for.body14.i.i97 98for.body14.i.i: ; preds = %for.body14.i.i, %entry99 %i.1424.i.i = phi i32 [ %inc21.i.i, %for.body14.i.i ], [ 0, %entry ]100 %next19.i.i = getelementptr inbounds %struct.CvNode1D2, ptr %src, i32 %i.1424.i.i, i32 0101 %loadp = load ptr, ptr %next19.i.i, align 4102 %arrayidx15.i.i1427 = getelementptr inbounds %struct.CvNode1D2, ptr %src, i32 %i.1424.i.i103 %val.i.i = getelementptr inbounds %struct.CvNode1D2, ptr %arrayidx15.i.i1427, i32 0, i32 1104 %loadf = load float, ptr %val.i.i, align 4105 %dst.ptr = getelementptr inbounds %struct.CvNode1D, ptr %dst, i32 %i.1424.i.i106 %dst.ptr.1 = getelementptr inbounds %struct.CvNode1D, ptr %dst, i32 %i.1424.i.i, i32 1107 store float %loadf, ptr %dst.ptr, align 4108 store ptr %loadp, ptr %dst.ptr.1, align 4109 %inc21.i.i = add nuw nsw i32 %i.1424.i.i, 1110 %exitcond438.i.i = icmp eq i32 %inc21.i.i, 1024111 br i1 %exitcond438.i.i, label %for.end22.i.i, label %for.body14.i.i112 113for.end22.i.i: ; preds = %for.body14.i.i114 unreachable115}116