[llvm] bb3e0d7 - [SLP]Fix PR79193: skip analysis of gather nodes for minbitwidth.
Alexey Bataev via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 23 12:48:04 PST 2024
Author: Alexey Bataev
Date: 2024-01-23T12:44:49-08:00
New Revision: bb3e0d7fc34899f22cbaea311982098bae3de061
URL: https://github.com/llvm/llvm-project/commit/bb3e0d7fc34899f22cbaea311982098bae3de061
DIFF: https://github.com/llvm/llvm-project/commit/bb3e0d7fc34899f22cbaea311982098bae3de061.diff
LOG: [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.
Added:
llvm/test/Transforms/SLPVectorizer/SystemZ/minbitwidth-non-vector-root.ll
Modified:
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
index 809d740aae3e097..601d2454c1e1635 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -13183,7 +13183,7 @@ void BoUpSLP::computeMinimumValueSizes() {
// We only attempt to truncate integer expressions.
auto &TreeRoot = VectorizableTree[0]->Scalars;
auto *TreeRootIT = dyn_cast<IntegerType>(TreeRoot[0]->getType());
- if (!TreeRootIT)
+ if (!TreeRootIT || VectorizableTree.front()->State == TreeEntry::NeedToGather)
return;
// Ensure the roots of the vectorizable tree don't form a cycle.
diff --git a/llvm/test/Transforms/SLPVectorizer/SystemZ/minbitwidth-non-vector-root.ll b/llvm/test/Transforms/SLPVectorizer/SystemZ/minbitwidth-non-vector-root.ll
new file mode 100644
index 000000000000000..6524b378f3d8bbb
--- /dev/null
+++ b/llvm/test/Transforms/SLPVectorizer/SystemZ/minbitwidth-non-vector-root.ll
@@ -0,0 +1,16 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
+; RUN: opt -passes=slp-vectorizer -S -slp-optimize-identity-hor-reduction-ops=false < %s -mtriple=s390x-ibm-linux -mcpu=arch13 | FileCheck %s
+
+define void @foo() {
+; CHECK-LABEL: define void @foo(
+; CHECK-SAME: ) #[[ATTR0:[0-9]+]] {
+; CHECK-NEXT: [[TMP1:%.*]] = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> zeroinitializer)
+; CHECK-NEXT: store i32 [[TMP1]], ptr null, align 4
+; CHECK-NEXT: ret void
+;
+ %1 = add i32 0, 0
+ %2 = add i32 %1, 0
+ %3 = add i32 %2, 0
+ store i32 %3, ptr null, align 4
+ ret void
+}
More information about the llvm-commits
mailing list