1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 2; RUN: opt < %s -basic-aa -slp-vectorizer -S -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7 | FileCheck %s 3 4; Check if the SLPVectorizer does not crash when handling 5; unreachable blocks with unscheduleable instructions. 6 7target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" 8target triple = "x86_64-apple-macosx10.9.0" 9 10define void @foo(i32* nocapture %x) #0 { 11; CHECK-LABEL: @foo( 12; CHECK-NEXT: entry: 13; CHECK-NEXT: br label [[BB2:%.*]] 14; CHECK: bb1: 15; CHECK-NEXT: [[T3:%.*]] = getelementptr inbounds i32, i32* [[X:%.*]], i64 4 16; CHECK-NEXT: [[T4:%.*]] = load i32, i32* [[T3]], align 4 17; CHECK-NEXT: [[T5:%.*]] = getelementptr inbounds i32, i32* [[X]], i64 5 18; CHECK-NEXT: [[T6:%.*]] = load i32, i32* [[T5]], align 4 19; CHECK-NEXT: [[BAD:%.*]] = fadd float [[BAD]], 0.000000e+00 20; CHECK-NEXT: [[T7:%.*]] = getelementptr inbounds i32, i32* [[X]], i64 6 21; CHECK-NEXT: [[T8:%.*]] = load i32, i32* [[T7]], align 4 22; CHECK-NEXT: [[T9:%.*]] = getelementptr inbounds i32, i32* [[X]], i64 7 23; CHECK-NEXT: [[T10:%.*]] = load i32, i32* [[T9]], align 4 24; CHECK-NEXT: br label [[BB2]] 25; CHECK: bb2: 26; CHECK-NEXT: [[T1_0:%.*]] = phi i32 [ [[T4]], [[BB1:%.*]] ], [ 2, [[ENTRY:%.*]] ] 27; CHECK-NEXT: [[T2_0:%.*]] = phi i32 [ [[T6]], [[BB1]] ], [ 2, [[ENTRY]] ] 28; CHECK-NEXT: [[T3_0:%.*]] = phi i32 [ [[T8]], [[BB1]] ], [ 2, [[ENTRY]] ] 29; CHECK-NEXT: [[T4_0:%.*]] = phi i32 [ [[T10]], [[BB1]] ], [ 2, [[ENTRY]] ] 30; CHECK-NEXT: store i32 [[T1_0]], i32* [[X]], align 4 31; CHECK-NEXT: [[T12:%.*]] = getelementptr inbounds i32, i32* [[X]], i64 1 32; CHECK-NEXT: store i32 [[T2_0]], i32* [[T12]], align 4 33; CHECK-NEXT: [[T13:%.*]] = getelementptr inbounds i32, i32* [[X]], i64 2 34; CHECK-NEXT: store i32 [[T3_0]], i32* [[T13]], align 4 35; CHECK-NEXT: [[T14:%.*]] = getelementptr inbounds i32, i32* [[X]], i64 3 36; CHECK-NEXT: store i32 [[T4_0]], i32* [[T14]], align 4 37; CHECK-NEXT: ret void 38; 39entry: 40 br label %bb2 41 42bb1: ; an unreachable block 43 %t3 = getelementptr inbounds i32, i32* %x, i64 4 44 %t4 = load i32, i32* %t3, align 4 45 %t5 = getelementptr inbounds i32, i32* %x, i64 5 46 %t6 = load i32, i32* %t5, align 4 47 %bad = fadd float %bad, 0.000000e+00 ; <- an instruction with self dependency, 48 ; but legal in unreachable code 49 %t7 = getelementptr inbounds i32, i32* %x, i64 6 50 %t8 = load i32, i32* %t7, align 4 51 %t9 = getelementptr inbounds i32, i32* %x, i64 7 52 %t10 = load i32, i32* %t9, align 4 53 br label %bb2 54 55bb2: 56 %t1.0 = phi i32 [ %t4, %bb1 ], [ 2, %entry ] 57 %t2.0 = phi i32 [ %t6, %bb1 ], [ 2, %entry ] 58 %t3.0 = phi i32 [ %t8, %bb1 ], [ 2, %entry ] 59 %t4.0 = phi i32 [ %t10, %bb1 ], [ 2, %entry ] 60 store i32 %t1.0, i32* %x, align 4 61 %t12 = getelementptr inbounds i32, i32* %x, i64 1 62 store i32 %t2.0, i32* %t12, align 4 63 %t13 = getelementptr inbounds i32, i32* %x, i64 2 64 store i32 %t3.0, i32* %t13, align 4 65 %t14 = getelementptr inbounds i32, i32* %x, i64 3 66 store i32 %t4.0, i32* %t14, align 4 67 ret void 68} 69 70