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 6@a = common global double 0.000000e+00, align 8 7 8define i32 @fn1() { 9entry: 10 %init = load double, double* @a, align 8 11 br label %loop 12 13loop: 14 %phi = phi double [ %add2, %loop ], [ %init, %entry ] 15 %postadd1_phi = phi double [ %postadd1, %loop ], [ %init, %entry ] 16 %postadd2_phi = phi double [ %postadd2, %loop ], [ %init, %entry ] 17 %add1 = fadd double %postadd1_phi, undef 18 %add2 = fadd double %postadd2_phi, %phi 19 %mul2 = fmul double %add2, 0.000000e+00 20 %binaryop_B = fadd double %postadd1_phi, %mul2 21 %mul1 = fmul double %add1, 0.000000e+00 22 %tmp = fadd double %postadd2_phi, 0.000000e+00 23 24 ; tryToVectorize() starts with this binary instruction. 25 ; At the same time vectorization wraps around the loop, vectorizes 26 ; postadd1/2 and eventually binary_V and tmp. So binary_V itself is replaced 27 ; with a vector instruction. 28 ; The SLPVectorizer crashed because it tried to use binary_V 29 ; after vectorization to re-arrange instructions. 30 %binary_V = fadd double %mul1, %binaryop_B 31 32 %postadd1 = fadd double %binary_V, 0.000000e+00 33 %postadd2 = fadd double %tmp, 1.000000e+00 34 %tobool = fcmp une double %postadd1, 0.000000e+00 35 br i1 %tobool, label %exit, label %loop 36 37exit: 38 ret i32 1 39} 40 41 42