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
4 ; Check if the SLPVectorizer does not crash when handling
5 ; unreachable blocks with unscheduleable instructions.
7 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
8 target triple = "x86_64-apple-macosx10.9.0"
10 define void @foo(i32* nocapture %x) #0 {
13 ; CHECK-NEXT: br label [[BB2:%.*]]
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]]
26 ; CHECK-NEXT: [[TMP0:%.*]] = phi <4 x i32> [ poison, [[BB1:%.*]] ], [ <i32 2, i32 2, i32 2, i32 2>, [[ENTRY:%.*]] ]
27 ; CHECK-NEXT: [[T12:%.*]] = getelementptr inbounds i32, i32* [[X]], i64 1
28 ; CHECK-NEXT: [[T13:%.*]] = getelementptr inbounds i32, i32* [[X]], i64 2
29 ; CHECK-NEXT: [[T14:%.*]] = getelementptr inbounds i32, i32* [[X]], i64 3
30 ; CHECK-NEXT: [[TMP1:%.*]] = bitcast i32* [[X]] to <4 x i32>*
31 ; CHECK-NEXT: store <4 x i32> [[TMP0]], <4 x i32>* [[TMP1]], align 4
32 ; CHECK-NEXT: ret void
37 bb1: ; an unreachable block
38 %t3 = getelementptr inbounds i32, i32* %x, i64 4
39 %t4 = load i32, i32* %t3, align 4
40 %t5 = getelementptr inbounds i32, i32* %x, i64 5
41 %t6 = load i32, i32* %t5, align 4
42 %bad = fadd float %bad, 0.000000e+00 ; <- an instruction with self dependency,
43 ; but legal in unreachable code
44 %t7 = getelementptr inbounds i32, i32* %x, i64 6
45 %t8 = load i32, i32* %t7, align 4
46 %t9 = getelementptr inbounds i32, i32* %x, i64 7
47 %t10 = load i32, i32* %t9, align 4
51 %t1.0 = phi i32 [ %t4, %bb1 ], [ 2, %entry ]
52 %t2.0 = phi i32 [ %t6, %bb1 ], [ 2, %entry ]
53 %t3.0 = phi i32 [ %t8, %bb1 ], [ 2, %entry ]
54 %t4.0 = phi i32 [ %t10, %bb1 ], [ 2, %entry ]
55 store i32 %t1.0, i32* %x, align 4
56 %t12 = getelementptr inbounds i32, i32* %x, i64 1
57 store i32 %t2.0, i32* %t12, align 4
58 %t13 = getelementptr inbounds i32, i32* %x, i64 2
59 store i32 %t3.0, i32* %t13, align 4
60 %t14 = getelementptr inbounds i32, i32* %x, i64 3
61 store i32 %t4.0, i32* %t14, align 4
68 ; CHECK-NEXT: [[TMP:%.*]] = load atomic i8*, i8** undef unordered, align 8
69 ; CHECK-NEXT: br label [[BB6:%.*]]
71 ; CHECK-NEXT: [[TMP4:%.*]] = load atomic i8*, i8** undef unordered, align 8
72 ; CHECK-NEXT: br label [[BB6]]
74 ; CHECK-NEXT: [[TMP7:%.*]] = phi i8* [ [[TMP]], [[BB5:%.*]] ], [ undef, [[BB:%.*]] ]
75 ; CHECK-NEXT: [[TMP8:%.*]] = phi i8* [ [[TMP4]], [[BB5]] ], [ undef, [[BB]] ]
76 ; CHECK-NEXT: ret void
79 %tmp = load atomic i8*, i8** undef unordered, align 8
82 bb5: ; No predecessors!
83 %tmp4 = load atomic i8*, i8** undef unordered, align 8
86 bb6: ; preds = %bb5, %bb
87 %tmp7 = phi i8* [ %tmp, %bb5 ], [ undef, %bb ]
88 %tmp8 = phi i8* [ %tmp4, %bb5 ], [ undef, %bb ]