Manoj Gupta | 6b54c7e | 2017-09-01 15:36:00 +0000 | [diff] [blame] | 1 | ; RUN: opt -loop-vectorize -S < %s | FileCheck %s |
| 2 | |
| 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. |
| 5 | |
| 6 | ; This test checks when a float value is stored into a pointer type. |
| 7 | |
| 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" |
| 12 | |
| 13 | %struct.CvNode1D = type { float, %struct.CvNode1D* } |
| 14 | |
| 15 | ; CHECK-LABEL: @cvCalcEMD2 |
| 16 | ; CHECK: vector.body |
| 17 | ; CHECK: store <{{[0-9]+}} x %struct.CvNode1D*> |
| 18 | define void @cvCalcEMD2() local_unnamed_addr #0 personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { |
| 19 | entry: |
| 20 | br label %for.body14.i.i |
| 21 | |
| 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, %struct.CvNode1D* undef, i32 %i.1424.i.i |
| 25 | %val.i.i = getelementptr inbounds %struct.CvNode1D, %struct.CvNode1D* %arrayidx15.i.i1427, i32 0, i32 0 |
| 26 | store float 0xC415AF1D80000000, float* %val.i.i, align 4 |
| 27 | %next19.i.i = getelementptr inbounds %struct.CvNode1D, %struct.CvNode1D* undef, i32 %i.1424.i.i, i32 1 |
| 28 | store %struct.CvNode1D* undef, %struct.CvNode1D** %next19.i.i, align 4 |
| 29 | %inc21.i.i = add nuw nsw i32 %i.1424.i.i, 1 |
| 30 | %exitcond438.i.i = icmp eq i32 %inc21.i.i, 0 |
| 31 | br i1 %exitcond438.i.i, label %for.end22.i.i, label %for.body14.i.i |
| 32 | |
| 33 | for.end22.i.i: ; preds = %for.body14.i.i |
| 34 | unreachable |
| 35 | } |
| 36 | |
| 37 | ; This test checks when a pointer value is stored into a float type. |
| 38 | |
| 39 | %struct.CvNode1D2 = type { %struct.CvNode1D2*, float } |
| 40 | |
| 41 | ; CHECK-LABEL: @cvCalcEMD2_2 |
| 42 | ; CHECK: vector.body |
| 43 | ; CHECK: store <{{[0-9]+}} x float> |
| 44 | define void @cvCalcEMD2_2() local_unnamed_addr #0 personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { |
| 45 | entry: |
| 46 | br label %for.body14.i.i |
| 47 | |
| 48 | for.body14.i.i: ; preds = %for.body14.i.i, %entry |
| 49 | %i.1424.i.i = phi i32 [ %inc21.i.i, %for.body14.i.i ], [ 0, %entry ] |
| 50 | %next19.i.i = getelementptr inbounds %struct.CvNode1D2, %struct.CvNode1D2* undef, i32 %i.1424.i.i, i32 0 |
| 51 | store %struct.CvNode1D2* undef, %struct.CvNode1D2** %next19.i.i, align 4 |
| 52 | %arrayidx15.i.i1427 = getelementptr inbounds %struct.CvNode1D2, %struct.CvNode1D2* undef, i32 %i.1424.i.i |
| 53 | %val.i.i = getelementptr inbounds %struct.CvNode1D2, %struct.CvNode1D2* %arrayidx15.i.i1427, i32 0, i32 1 |
| 54 | store float 0xC415AF1D80000000, float* %val.i.i, align 4 |
| 55 | %inc21.i.i = add nuw nsw i32 %i.1424.i.i, 1 |
| 56 | %exitcond438.i.i = icmp eq i32 %inc21.i.i, 0 |
| 57 | br i1 %exitcond438.i.i, label %for.end22.i.i, label %for.body14.i.i |
| 58 | |
| 59 | for.end22.i.i: ; preds = %for.body14.i.i |
| 60 | unreachable |
| 61 | } |
| 62 | |
Manoj Gupta | 7476f62 | 2017-09-18 17:28:15 +0000 | [diff] [blame] | 63 | ; This test checks for the intoptr conversions with load instructions. |
| 64 | |
| 65 | ; CHECK-LABEL: @cvCalcEMD3 |
| 66 | ; CHECK: vector.body |
| 67 | ; CHECK: inttoptr <{{[0-9]+}} x i32> |
| 68 | define void @cvCalcEMD3() local_unnamed_addr #0 personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { |
| 69 | entry: |
| 70 | br label %for.body14.i.i |
| 71 | |
| 72 | for.body14.i.i: ; preds = %for.body14.i.i, %entry |
| 73 | %i.1424.i.i = phi i32 [ %inc21.i.i, %for.body14.i.i ], [ 0, %entry ] |
| 74 | %arrayidx15.i.i1427 = getelementptr inbounds %struct.CvNode1D, %struct.CvNode1D* undef, i32 %i.1424.i.i |
| 75 | %val.i.i = getelementptr inbounds %struct.CvNode1D, %struct.CvNode1D* %arrayidx15.i.i1427, i32 0, i32 0 |
| 76 | %loadf = load float, float* %val.i.i, align 4 |
| 77 | %next19.i.i = getelementptr inbounds %struct.CvNode1D, %struct.CvNode1D* undef, i32 %i.1424.i.i, i32 1 |
| 78 | %loadp = load %struct.CvNode1D*, %struct.CvNode1D** %next19.i.i, align 4 |
| 79 | %inc21.i.i = add nuw nsw i32 %i.1424.i.i, 1 |
| 80 | %exitcond438.i.i = icmp eq i32 %inc21.i.i, 0 |
| 81 | br i1 %exitcond438.i.i, label %for.end22.i.i, label %for.body14.i.i |
| 82 | |
| 83 | for.end22.i.i: ; preds = %for.body14.i.i |
| 84 | unreachable |
| 85 | } |
| 86 | |
| 87 | ; This test checks for ptrtoint conversions with load instructions. |
| 88 | |
| 89 | ; CHECK-LABEL: @cvCalcEMD3_2 |
| 90 | ; CHECK: vector.body |
| 91 | ; CHECK: ptrtoint <{{[0-9]+}} x %struct.CvNode1D2*> |
| 92 | define void @cvCalcEMD3_2() local_unnamed_addr #0 personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { |
| 93 | entry: |
| 94 | br label %for.body14.i.i |
| 95 | |
| 96 | for.body14.i.i: ; preds = %for.body14.i.i, %entry |
| 97 | %i.1424.i.i = phi i32 [ %inc21.i.i, %for.body14.i.i ], [ 0, %entry ] |
| 98 | %next19.i.i = getelementptr inbounds %struct.CvNode1D2, %struct.CvNode1D2* undef, i32 %i.1424.i.i, i32 0 |
| 99 | %loadp = load %struct.CvNode1D2*, %struct.CvNode1D2** %next19.i.i, align 4 |
| 100 | %arrayidx15.i.i1427 = getelementptr inbounds %struct.CvNode1D2, %struct.CvNode1D2* undef, i32 %i.1424.i.i |
| 101 | %val.i.i = getelementptr inbounds %struct.CvNode1D2, %struct.CvNode1D2* %arrayidx15.i.i1427, i32 0, i32 1 |
| 102 | %loadf = load float, float* %val.i.i, align 4 |
| 103 | %inc21.i.i = add nuw nsw i32 %i.1424.i.i, 1 |
| 104 | %exitcond438.i.i = icmp eq i32 %inc21.i.i, 0 |
| 105 | br i1 %exitcond438.i.i, label %for.end22.i.i, label %for.body14.i.i |
| 106 | |
| 107 | for.end22.i.i: ; preds = %for.body14.i.i |
| 108 | unreachable |
| 109 | } |
| 110 | |
Manoj Gupta | 6b54c7e | 2017-09-01 15:36:00 +0000 | [diff] [blame] | 111 | declare i32 @__gxx_personality_v0(...) |
| 112 | |
| 113 | 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" } |
| 114 | |