1 ; RUN: opt -passes=loop-vectorize -S < %s | FileCheck %s
3 ; These tests check that we don't crash if vectorizer decides to cast
4 ; a float value to be stored into a pointer type or vice-versa.
6 ; This test checks when a float value is stored into a pointer type.
8 ; ModuleID = 'bugpoint-reduced-simplified.bc'
9 source_filename = "bugpoint-output-26dbd81.bc"
10 target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
11 target triple = "armv7-unknown-linux-gnueabihf"
13 %struct.CvNode1D = type { float, ptr }
15 ; CHECK-LABEL: @cvCalcEMD2
17 ; CHECK: store <{{[0-9]+}} x ptr>
18 define void @cvCalcEMD2() local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
20 br label %for.body14.i.i
22 for.body14.i.i: ; preds = %for.body14.i.i, %entry
23 %i.1424.i.i = phi i32 [ %inc21.i.i, %for.body14.i.i ], [ 0, %entry ]
24 %arrayidx15.i.i1427 = getelementptr inbounds %struct.CvNode1D, ptr undef, i32 %i.1424.i.i
25 store float 0xC415AF1D80000000, ptr %arrayidx15.i.i1427, align 4
26 %next19.i.i = getelementptr inbounds %struct.CvNode1D, ptr undef, i32 %i.1424.i.i, i32 1
27 store ptr undef, ptr %next19.i.i, align 4
28 %inc21.i.i = add nuw nsw i32 %i.1424.i.i, 1
29 %exitcond438.i.i = icmp eq i32 %inc21.i.i, 0
30 br i1 %exitcond438.i.i, label %for.end22.i.i, label %for.body14.i.i
32 for.end22.i.i: ; preds = %for.body14.i.i
36 ; This test checks when a pointer value is stored into a float type.
38 %struct.CvNode1D2 = type { ptr, float }
40 ; CHECK-LABEL: @cvCalcEMD2_2
42 ; CHECK: store <{{[0-9]+}} x float>
43 define void @cvCalcEMD2_2() local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
45 br label %for.body14.i.i
47 for.body14.i.i: ; preds = %for.body14.i.i, %entry
48 %i.1424.i.i = phi i32 [ %inc21.i.i, %for.body14.i.i ], [ 0, %entry ]
49 %next19.i.i = getelementptr inbounds %struct.CvNode1D2, ptr undef, i32 %i.1424.i.i, i32 0
50 store ptr undef, ptr %next19.i.i, align 4
51 %arrayidx15.i.i1427 = getelementptr inbounds %struct.CvNode1D2, ptr undef, i32 %i.1424.i.i
52 %val.i.i = getelementptr inbounds %struct.CvNode1D2, ptr %arrayidx15.i.i1427, i32 0, i32 1
53 store float 0xC415AF1D80000000, ptr %val.i.i, align 4
54 %inc21.i.i = add nuw nsw i32 %i.1424.i.i, 1
55 %exitcond438.i.i = icmp eq i32 %inc21.i.i, 0
56 br i1 %exitcond438.i.i, label %for.end22.i.i, label %for.body14.i.i
58 for.end22.i.i: ; preds = %for.body14.i.i
62 ; This test checks for the intoptr conversions with load instructions.
64 ; CHECK-LABEL: @cvCalcEMD3
66 ; CHECK: inttoptr <{{[0-9]+}} x i32>
67 define void @cvCalcEMD3() local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
69 br label %for.body14.i.i
71 for.body14.i.i: ; preds = %for.body14.i.i, %entry
72 %i.1424.i.i = phi i32 [ %inc21.i.i, %for.body14.i.i ], [ 0, %entry ]
73 %arrayidx15.i.i1427 = getelementptr inbounds %struct.CvNode1D, ptr undef, i32 %i.1424.i.i
74 %loadf = load float, ptr %arrayidx15.i.i1427, align 4
75 %next19.i.i = getelementptr inbounds %struct.CvNode1D, ptr undef, i32 %i.1424.i.i, i32 1
76 %loadp = load ptr, ptr %next19.i.i, align 4
77 %inc21.i.i = add nuw nsw i32 %i.1424.i.i, 1
78 %exitcond438.i.i = icmp eq i32 %inc21.i.i, 0
79 br i1 %exitcond438.i.i, label %for.end22.i.i, label %for.body14.i.i
81 for.end22.i.i: ; preds = %for.body14.i.i
85 ; This test checks for ptrtoint conversions with load instructions.
87 ; CHECK-LABEL: @cvCalcEMD3_2
89 ; CHECK: ptrtoint <{{[0-9]+}} x ptr>
90 define void @cvCalcEMD3_2() local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
92 br label %for.body14.i.i
94 for.body14.i.i: ; preds = %for.body14.i.i, %entry
95 %i.1424.i.i = phi i32 [ %inc21.i.i, %for.body14.i.i ], [ 0, %entry ]
96 %next19.i.i = getelementptr inbounds %struct.CvNode1D2, ptr undef, i32 %i.1424.i.i, i32 0
97 %loadp = load ptr, ptr %next19.i.i, align 4
98 %arrayidx15.i.i1427 = getelementptr inbounds %struct.CvNode1D2, ptr undef, i32 %i.1424.i.i
99 %val.i.i = getelementptr inbounds %struct.CvNode1D2, ptr %arrayidx15.i.i1427, i32 0, i32 1
100 %loadf = load float, ptr %val.i.i, align 4
101 %inc21.i.i = add nuw nsw i32 %i.1424.i.i, 1
102 %exitcond438.i.i = icmp eq i32 %inc21.i.i, 0
103 br i1 %exitcond438.i.i, label %for.end22.i.i, label %for.body14.i.i
105 for.end22.i.i: ; preds = %for.body14.i.i
109 declare i32 @__gxx_personality_v0(...)
111 attributes #0 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="all" "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" }