Skip to content

Commit bb3e0d7

Browse files
committed
[SLP]Fix PR79193: skip analysis of gather nodes for minbitwidth.
No need in trying to analyze small graphs with gather node only to avoid crash.
1 parent b504e97 commit bb3e0d7

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13183,7 +13183,7 @@ void BoUpSLP::computeMinimumValueSizes() {
1318313183
// We only attempt to truncate integer expressions.
1318413184
auto &TreeRoot = VectorizableTree[0]->Scalars;
1318513185
auto *TreeRootIT = dyn_cast<IntegerType>(TreeRoot[0]->getType());
13186-
if (!TreeRootIT)
13186+
if (!TreeRootIT || VectorizableTree.front()->State == TreeEntry::NeedToGather)
1318713187
return;
1318813188

1318913189
// Ensure the roots of the vectorizable tree don't form a cycle.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
2+
; RUN: opt -passes=slp-vectorizer -S -slp-optimize-identity-hor-reduction-ops=false < %s -mtriple=s390x-ibm-linux -mcpu=arch13 | FileCheck %s
3+
4+
define void @foo() {
5+
; CHECK-LABEL: define void @foo(
6+
; CHECK-SAME: ) #[[ATTR0:[0-9]+]] {
7+
; CHECK-NEXT: [[TMP1:%.*]] = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> zeroinitializer)
8+
; CHECK-NEXT: store i32 [[TMP1]], ptr null, align 4
9+
; CHECK-NEXT: ret void
10+
;
11+
%1 = add i32 0, 0
12+
%2 = add i32 %1, 0
13+
%3 = add i32 %2, 0
14+
store i32 %3, ptr null, align 4
15+
ret void
16+
}

0 commit comments

Comments
 (0)