1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
|
; RUN: opt -passes=loop-vectorize -S < %s | FileCheck %s
; These tests check that we don't crash if vectorizer decides to cast
; a double value to be stored into a pointer type or vice-versa.
; This test checks when a double value is stored into a pointer type.
; ModuleID = 'bugpoint-reduced-simplified.bc'
source_filename = "bugpoint-output-26dbd81.bc"
target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
target triple = "aarch64-unknown-linux-gnu"
%struct.CvNode1D = type { double, ptr }
; CHECK-LABEL: @cvCalcEMD2
; CHECK: vector.body
; CHECK: store <{{[0-9]+}} x ptr>
define void @cvCalcEMD2(ptr %dst) {
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, ptr %dst, i32 %i.1424.i.i
store double 0xC415AF1D80000000, ptr %arrayidx15.i.i1427, align 4
%next19.i.i = getelementptr inbounds %struct.CvNode1D, ptr %dst, i32 %i.1424.i.i, i32 1
store ptr %dst, ptr %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 when a pointer value is stored into a double type.
%struct.CvNode1D2 = type { ptr, double }
; CHECK-LABEL: @cvCalcEMD2_2
; CHECK: vector.body
; CHECK: store <{{[0-9]+}} x double>
define void @cvCalcEMD2_2(ptr %dst) {
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, ptr %dst, i32 %i.1424.i.i, i32 0
store ptr %dst, ptr %next19.i.i, align 4
%arrayidx15.i.i1427 = getelementptr inbounds %struct.CvNode1D2, ptr %dst, i32 %i.1424.i.i
%val.i.i = getelementptr inbounds %struct.CvNode1D2, ptr %arrayidx15.i.i1427, i32 0, i32 1
store double 0xC415AF1D80000000, ptr %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
}
; 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(ptr %src, ptr %dst) {
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, ptr %src, i32 %i.1424.i.i
%load_d = load double, ptr %arrayidx15.i.i1427, align 4
%next19.i.i = getelementptr inbounds %struct.CvNode1D, ptr %src, i32 %i.1424.i.i, i32 1
%load_p = load ptr, ptr %next19.i.i, align 4
%dst.ptr = getelementptr inbounds %struct.CvNode1D, ptr %dst, i32 %i.1424.i.i
%dst.ptr.1 = getelementptr inbounds %struct.CvNode1D, ptr %dst, i32 %i.1424.i.i, i32 1
store double %load_d, ptr %dst.ptr, align 4
store ptr %load_p, ptr %dst.ptr.1, 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 ptr>
define void @cvCalcEMD3_2(ptr %src, ptr %dst) {
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, ptr %src, i32 %i.1424.i.i, i32 0
%load_p = load ptr, ptr %next19.i.i, align 4
%arrayidx15.i.i1427 = getelementptr inbounds %struct.CvNode1D2, ptr %src, i32 %i.1424.i.i
%val.i.i = getelementptr inbounds %struct.CvNode1D2, ptr %arrayidx15.i.i1427, i32 0, i32 1
%load_d = load double, ptr %val.i.i, align 4
%dst.ptr = getelementptr inbounds %struct.CvNode1D, ptr %dst, i32 %i.1424.i.i
%dst.ptr.1 = getelementptr inbounds %struct.CvNode1D, ptr %dst, i32 %i.1424.i.i, i32 1
store double %load_d, ptr %dst.ptr, align 4
store ptr %load_p, ptr %dst.ptr.1, 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
}
|