Skip to content

Commit d65ff3e

Browse files
committed
[SLP]Fix PR107198: add a check for empty complex type
Need to check if the complex type is empty before trying to dig in, trying to find vectorizable type Fixes #107198
1 parent c2b92a4 commit d65ff3e

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7780,6 +7780,8 @@ unsigned BoUpSLP::canMapToVector(Type *T) const {
77807780
Type *EltTy = T;
77817781

77827782
while (isa<StructType, ArrayType, FixedVectorType>(EltTy)) {
7783+
if (EltTy->isEmptyTy())
7784+
return 0;
77837785
if (auto *ST = dyn_cast<StructType>(EltTy)) {
77847786
// Check that struct is homogeneous.
77857787
for (const auto *Ty : ST->elements())
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
2+
; RUN: opt -S --passes=slp-vectorizer < %s | FileCheck %s
3+
4+
define { { {}, {}, {}, {}, {}, {}, {} } } @test({ {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, { {}, {}, {}, {}, {}, {}, {} }, { {} } } %0) {
5+
; CHECK-LABEL: define { { {}, {}, {}, {}, {}, {}, {} } } @test(
6+
; CHECK-SAME: { {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, { {}, {}, {}, {}, {}, {}, {} }, { {} } } [[TMP0:%.*]]) {
7+
; CHECK-NEXT: [[TMP2:%.*]] = extractvalue { {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, { {}, {}, {}, {}, {}, {}, {} }, { {} } } [[TMP0]], 18
8+
; CHECK-NEXT: [[TMP3:%.*]] = insertvalue { { {}, {}, {}, {}, {}, {}, {} } } undef, { {}, {}, {}, {}, {}, {}, {} } [[TMP2]], 0
9+
; CHECK-NEXT: ret { { {}, {}, {}, {}, {}, {}, {} } } [[TMP3]]
10+
;
11+
%2 = extractvalue { {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, { {}, {}, {}, {}, {}, {}, {} }, { {} } } %0, 18
12+
%3 = insertvalue { { {}, {}, {}, {}, {}, {}, {} } } undef, { {}, {}, {}, {}, {}, {}, {} } %2, 0
13+
ret { { {}, {}, {}, {}, {}, {}, {} } } %3
14+
}

0 commit comments

Comments
 (0)