1; RUN: opt -basicaa -slp-vectorizer -mtriple=x86_64-apple-macosx10.9.0 -mcpu=corei7-avx -S < %s | FileCheck %s 2target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" 3target triple = "x86_64-apple-macosx10.9.0" 4 5 6; This test used to crash because we were following phi chains incorrectly. 7; We used indices to get the incoming value of two phi nodes rather than 8; incoming block lookup. 9; This can give wrong results when the ordering of incoming 10; edges in the two phi nodes don't match. 11;CHECK-LABEL: bar 12 13%0 = type { %1, %2 } 14%1 = type { double, double } 15%2 = type { double, double } 16 17 18;define fastcc void @bar() { 19define void @bar() { 20 %1 = getelementptr inbounds %0, %0* undef, i64 0, i32 1, i32 0 21 %2 = getelementptr inbounds %0, %0* undef, i64 0, i32 1, i32 1 22 %3 = getelementptr inbounds %0, %0* undef, i64 0, i32 1, i32 0 23 %4 = getelementptr inbounds %0, %0* undef, i64 0, i32 1, i32 1 24 %5 = getelementptr inbounds %0, %0* undef, i64 0, i32 1, i32 0 25 %6 = getelementptr inbounds %0, %0* undef, i64 0, i32 1, i32 1 26 br label %7 27 28; <label>:7 ; preds = %18, %17, %17, %0 29 %8 = phi double [ 2.800000e+01, %0 ], [ %11, %18 ], [ %11, %17 ], [ %11, %17 ] 30 %9 = phi double [ 1.800000e+01, %0 ], [ %10, %18 ], [ %10, %17 ], [ %10, %17 ] 31 store double %9, double* %1, align 8 32 store double %8, double* %2, align 8 33 %10 = load double, double* %3, align 8 34 %11 = load double, double* %4, align 8 35 br i1 undef, label %12, label %13 36 37; <label>:12 ; preds = %7 38 ret void 39 40; <label>:13 ; preds = %7 41 store double %10, double* %5, align 8 42 store double %11, double* %6, align 8 43 br i1 undef, label %14, label %15 44 45; <label>:14 ; preds = %13 46 br label %15 47 48; <label>:15 ; preds = %14, %13 49 br i1 undef, label %16, label %17 50 51; <label>:16 ; preds = %15 52 unreachable 53 54; <label>:17 ; preds = %15 55 switch i32 undef, label %18 [ 56 i32 32, label %7 57 i32 103, label %7 58 ] 59 60; <label>:18 ; preds = %17 61 br i1 undef, label %7, label %19 62 63; <label>:19 ; preds = %18 64 unreachable 65} 66