1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -basicaa -disable-verify -slp-vectorizer -S -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7 | FileCheck %s
4 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
5 target triple = "x86_64-apple-darwin13.3.0"
7 define void @_foo(double %p1, double %p2, double %p3) #0 {
10 ; CHECK-NEXT: [[TAB1:%.*]] = alloca [256 x i32], align 16
11 ; CHECK-NEXT: [[TAB2:%.*]] = alloca [256 x i32], align 16
12 ; CHECK-NEXT: br label [[BB1:%.*]]
14 ; CHECK-NEXT: [[MUL19:%.*]] = fmul double [[P1:%.*]], 1.638400e+04
15 ; CHECK-NEXT: [[MUL20:%.*]] = fmul double [[P3:%.*]], 1.638400e+04
16 ; CHECK-NEXT: [[ADD:%.*]] = fadd double [[MUL20]], 8.192000e+03
17 ; CHECK-NEXT: [[MUL21:%.*]] = fmul double [[P2:%.*]], 1.638400e+04
18 ; CHECK-NEXT: br label [[FOR_BODY:%.*]]
20 ; CHECK-NEXT: [[INDVARS_IV266:%.*]] = phi i64 [ 0, [[BB1]] ], [ [[INDVARS_IV_NEXT267:%.*]], [[FOR_BODY]] ]
21 ; CHECK-NEXT: [[T_0259:%.*]] = phi double [ 0.000000e+00, [[BB1]] ], [ [[ADD27:%.*]], [[FOR_BODY]] ]
22 ; CHECK-NEXT: [[P3_ADDR_0258:%.*]] = phi double [ [[ADD]], [[BB1]] ], [ [[ADD28:%.*]], [[FOR_BODY]] ]
23 ; CHECK-NEXT: [[VECINIT_I_I237:%.*]] = insertelement <2 x double> undef, double [[T_0259]], i32 0
24 ; CHECK-NEXT: [[X13:%.*]] = tail call i32 @_xfn(<2 x double> [[VECINIT_I_I237]])
25 ; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds [256 x i32], [256 x i32]* [[TAB1]], i64 0, i64 [[INDVARS_IV266]]
26 ; CHECK-NEXT: store i32 [[X13]], i32* [[ARRAYIDX]], align 4, !tbaa !0
27 ; CHECK-NEXT: [[VECINIT_I_I:%.*]] = insertelement <2 x double> undef, double [[P3_ADDR_0258]], i32 0
28 ; CHECK-NEXT: [[X14:%.*]] = tail call i32 @_xfn(<2 x double> [[VECINIT_I_I]])
29 ; CHECK-NEXT: [[ARRAYIDX26:%.*]] = getelementptr inbounds [256 x i32], [256 x i32]* [[TAB2]], i64 0, i64 [[INDVARS_IV266]]
30 ; CHECK-NEXT: store i32 [[X14]], i32* [[ARRAYIDX26]], align 4, !tbaa !0
31 ; CHECK-NEXT: [[ADD27]] = fadd double [[MUL19]], [[T_0259]]
32 ; CHECK-NEXT: [[ADD28]] = fadd double [[MUL21]], [[P3_ADDR_0258]]
33 ; CHECK-NEXT: [[INDVARS_IV_NEXT267]] = add nuw nsw i64 [[INDVARS_IV266]], 1
34 ; CHECK-NEXT: [[EXITCOND:%.*]] = icmp eq i64 [[INDVARS_IV_NEXT267]], 256
35 ; CHECK-NEXT: br i1 [[EXITCOND]], label [[RETURN:%.*]], label [[FOR_BODY]]
37 ; CHECK-NEXT: ret void
40 %tab1 = alloca [256 x i32], align 16
41 %tab2 = alloca [256 x i32], align 16
46 %mul19 = fmul double %p1, 1.638400e+04
47 %mul20 = fmul double %p3, 1.638400e+04
48 %add = fadd double %mul20, 8.192000e+03
49 %mul21 = fmul double %p2, 1.638400e+04
50 ; The SLPVectorizer crashed when scheduling this block after it inserted an
51 ; insertelement instruction (during vectorizing the for.body block) at this position.
55 %indvars.iv266 = phi i64 [ 0, %bb1 ], [ %indvars.iv.next267, %for.body ]
56 %t.0259 = phi double [ 0.000000e+00, %bb1 ], [ %add27, %for.body ]
57 %p3.addr.0258 = phi double [ %add, %bb1 ], [ %add28, %for.body ]
58 %vecinit.i.i237 = insertelement <2 x double> undef, double %t.0259, i32 0
59 %x13 = tail call i32 @_xfn(<2 x double> %vecinit.i.i237) #2
60 %arrayidx = getelementptr inbounds [256 x i32], [256 x i32]* %tab1, i64 0, i64 %indvars.iv266
61 store i32 %x13, i32* %arrayidx, align 4, !tbaa !4
62 %vecinit.i.i = insertelement <2 x double> undef, double %p3.addr.0258, i32 0
63 %x14 = tail call i32 @_xfn(<2 x double> %vecinit.i.i) #2
64 %arrayidx26 = getelementptr inbounds [256 x i32], [256 x i32]* %tab2, i64 0, i64 %indvars.iv266
65 store i32 %x14, i32* %arrayidx26, align 4, !tbaa !4
66 %add27 = fadd double %mul19, %t.0259
67 %add28 = fadd double %mul21, %p3.addr.0258
68 %indvars.iv.next267 = add nuw nsw i64 %indvars.iv266, 1
69 %exitcond = icmp eq i64 %indvars.iv.next267, 256
70 br i1 %exitcond, label %return, label %for.body
76 declare i32 @_xfn(<2 x double>) #4
78 !3 = !{!"int", !4, i64 0}