1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -mtriple=x86_64-- -passes=slp-vectorizer -S < %s | FileCheck %s
4 ; Crash Test case reported on D134605
6 define i16 @D134605() {
7 ; CHECK-LABEL: @D134605(
9 ; CHECK-NEXT: [[TMP0:%.*]] = load <4 x i16>, ptr poison, align 1
10 ; CHECK-NEXT: [[TMP1:%.*]] = extractelement <4 x i16> [[TMP0]], i32 3
11 ; CHECK-NEXT: [[REASS_ADD:%.*]] = add i16 poison, [[TMP1]]
12 ; CHECK-NEXT: [[TMP2:%.*]] = call i16 @llvm.vector.reduce.add.v4i16(<4 x i16> [[TMP0]])
13 ; CHECK-NEXT: [[TMP3:%.*]] = mul i16 [[TMP2]], 2
14 ; CHECK-NEXT: [[OP_RDX:%.*]] = add i16 [[TMP3]], poison
15 ; CHECK-NEXT: [[REASS_MUL24:%.*]] = shl i16 [[OP_RDX]], 2
16 ; CHECK-NEXT: [[CALL:%.*]] = call i16 @check_i16(i16 noundef 1, i16 noundef [[REASS_MUL24]], i16 noundef 5120)
17 ; CHECK-NEXT: unreachable
20 %arrayidx81 = getelementptr inbounds [32 x i16], ptr poison, i16 0, i16 3
21 %0 = load i16, ptr %arrayidx81, align 1
22 %1 = load i16, ptr poison, align 1
23 %arrayidx101 = getelementptr inbounds [32 x i16], ptr poison, i16 0, i16 1
24 %2 = load i16, ptr %arrayidx101, align 1
25 %arrayidx107 = getelementptr inbounds [32 x i16], ptr poison, i16 0, i16 2
26 %3 = load i16, ptr %arrayidx107, align 1
27 %reass.add = add i16 poison, %0
28 %add116 = add i16 %1, %0
29 %add122 = add i16 %add116, %2
30 %add124 = add i16 %add122, %3
31 %add125 = add i16 %add124, poison
32 %factor2531 = add i16 %3, %add125
33 %add14332 = add i16 %factor2531, %2
34 %add14933 = add i16 %add14332, %1
35 %add15534 = add i16 %add14933, %0
36 %add15935 = add i16 %add15534, poison
37 %reass.mul24 = shl i16 %add15935, 2
38 %call = call i16 @check_i16(i16 noundef 1, i16 noundef %reass.mul24, i16 noundef 5120)
41 declare i16 @check_i16(i16, i16, i16)
44 define void @PR58054() {
45 ; CHECK-LABEL: @PR58054(
46 ; CHECK-NEXT: [[VAL:%.*]] = add i64 poison, poison
47 ; CHECK-NEXT: [[VAL2:%.*]] = add i64 poison, poison
48 ; CHECK-NEXT: [[VAL3:%.*]] = mul i64 [[VAL2]], [[VAL]]
49 ; CHECK-NEXT: [[VAL4:%.*]] = mul i64 [[VAL3]], [[VAL2]]
50 ; CHECK-NEXT: [[VAL5:%.*]] = mul i64 [[VAL4]], [[VAL2]]
51 ; CHECK-NEXT: [[VAL7:%.*]] = add i64 [[VAL]], [[VAL5]]
52 ; CHECK-NEXT: [[VAL8:%.*]] = sitofp i64 [[VAL7]] to double
53 ; CHECK-NEXT: call void @wibble(i32 poison, double [[VAL8]], i64 poison)
54 ; CHECK-NEXT: unreachable
56 %val = add i64 poison, poison
57 %val2 = add i64 poison, poison
58 %val3 = mul i64 %val2, %val
59 %val4 = mul i64 %val3, %val2
60 %val5 = mul i64 %val4, %val2
61 %val7 = add i64 %val, %val5
62 %val8 = sitofp i64 %val7 to double
63 call void @wibble(i32 poison, double %val8, i64 poison)
66 declare void @wibble(i32, double, i64)