1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -slp-vectorizer -S < %s -mtriple=x86_64-unknown-linux -mcpu=corei7-avx | FileCheck %s
4 define i32 @crash_reordering_undefs() {
5 ; CHECK-LABEL: @crash_reordering_undefs(
7 ; CHECK-NEXT: [[OR0:%.*]] = or i64 undef, undef
8 ; CHECK-NEXT: [[CMP0:%.*]] = icmp eq i64 undef, [[OR0]]
9 ; CHECK-NEXT: [[ADD0:%.*]] = select i1 [[CMP0]], i32 65536, i32 65537
10 ; CHECK-NEXT: [[ADD1:%.*]] = add i32 undef, [[ADD0]]
11 ; CHECK-NEXT: [[CMP1:%.*]] = icmp eq i64 undef, undef
12 ; CHECK-NEXT: [[ADD2:%.*]] = select i1 [[CMP1]], i32 65536, i32 65537
13 ; CHECK-NEXT: [[ADD3:%.*]] = add i32 [[ADD1]], [[ADD2]]
14 ; CHECK-NEXT: [[CMP2:%.*]] = icmp eq i64 undef, undef
15 ; CHECK-NEXT: [[ADD4:%.*]] = select i1 [[CMP2]], i32 65536, i32 65537
16 ; CHECK-NEXT: [[ADD5:%.*]] = add i32 [[ADD3]], [[ADD4]]
17 ; CHECK-NEXT: [[ADD6:%.*]] = add i32 [[ADD5]], undef
18 ; CHECK-NEXT: [[ADD7:%.*]] = add i32 [[ADD6]], undef
19 ; CHECK-NEXT: [[ADD8:%.*]] = add i32 [[ADD7]], undef
20 ; CHECK-NEXT: [[OR1:%.*]] = or i64 undef, undef
21 ; CHECK-NEXT: [[CMP3:%.*]] = icmp eq i64 undef, [[OR1]]
22 ; CHECK-NEXT: [[ADD9:%.*]] = select i1 [[CMP3]], i32 65536, i32 65537
23 ; CHECK-NEXT: [[ADD10:%.*]] = add i32 [[ADD8]], [[ADD9]]
24 ; CHECK-NEXT: [[ADD11:%.*]] = add i32 [[ADD10]], undef
25 ; CHECK-NEXT: ret i32 [[ADD11]]
28 %or0 = or i64 undef, undef
29 %cmp0 = icmp eq i64 undef, %or0
30 %add0 = select i1 %cmp0, i32 65536, i32 65537
31 %add1 = add i32 undef, %add0
32 %cmp1 = icmp eq i64 undef, undef
33 %add2 = select i1 %cmp1, i32 65536, i32 65537
34 %add3 = add i32 %add1, %add2
35 %cmp2 = icmp eq i64 undef, undef
36 %add4 = select i1 %cmp2, i32 65536, i32 65537
37 %add5 = add i32 %add3, %add4
38 %add6 = add i32 %add5, undef
39 %add7 = add i32 %add6, undef
40 %add8 = add i32 %add7, undef
41 %or1 = or i64 undef, undef
42 %cmp3 = icmp eq i64 undef, %or1
43 %add9 = select i1 %cmp3, i32 65536, i32 65537
44 %add10 = add i32 %add8, %add9
45 %add11 = add i32 %add10, undef