1; RUN: opt < %s -basicaa -slp-vectorizer -S -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7
2
3target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
4target triple = "x86_64-apple-darwin13.3.0"
5
6define void @_foo(double %p1, double %p2, double %p3) #0 {
7entry:
8  %tab1 = alloca [256 x i32], align 16
9  %tab2 = alloca [256 x i32], align 16
10  br label %bb1
11
12
13bb1:
14  %mul19 = fmul double %p1, 1.638400e+04
15  %mul20 = fmul double %p3, 1.638400e+04
16  %add = fadd double %mul20, 8.192000e+03
17  %mul21 = fmul double %p2, 1.638400e+04
18  ; The SLPVectorizer crashed when scheduling this block after it inserted an
19  ; insertelement instruction (during vectorizing the for.body block) at this position.
20  br label %for.body
21
22for.body:
23  %indvars.iv266 = phi i64 [ 0, %bb1 ], [ %indvars.iv.next267, %for.body ]
24  %t.0259 = phi double [ 0.000000e+00, %bb1 ], [ %add27, %for.body ]
25  %p3.addr.0258 = phi double [ %add, %bb1 ], [ %add28, %for.body ]
26  %vecinit.i.i237 = insertelement <2 x double> undef, double %t.0259, i32 0
27  %x13 = tail call i32 @_xfn(<2 x double> %vecinit.i.i237) #2
28  %arrayidx = getelementptr inbounds [256 x i32]* %tab1, i64 0, i64 %indvars.iv266
29  store i32 %x13, i32* %arrayidx, align 4, !tbaa !4
30  %vecinit.i.i = insertelement <2 x double> undef, double %p3.addr.0258, i32 0
31  %x14 = tail call i32 @_xfn(<2 x double> %vecinit.i.i) #2
32  %arrayidx26 = getelementptr inbounds [256 x i32]* %tab2, i64 0, i64 %indvars.iv266
33  store i32 %x14, i32* %arrayidx26, align 4, !tbaa !4
34  %add27 = fadd double %mul19, %t.0259
35  %add28 = fadd double %mul21, %p3.addr.0258
36  %indvars.iv.next267 = add nuw nsw i64 %indvars.iv266, 1
37  %exitcond = icmp eq i64 %indvars.iv.next267, 256
38  br i1 %exitcond, label %return, label %for.body
39
40return:
41  ret void
42}
43
44declare i32 @_xfn(<2 x double>) #4
45
46!3 = !{!"int", !4, i64 0}
47!4 = !{!3, !3, i64 0}
48