[llvm] 9f3b6ad - [SLP][NFC]Exit early if the graph is empty, NFC
Alexey Bataev via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 6 08:33:25 PST 2024
Author: Alexey Bataev
Date: 2024-11-06T08:33:14-08:00
New Revision: 9f3b6adb1508a714dc12aa020a20d813d9ab9f42
URL: https://github.com/llvm/llvm-project/commit/9f3b6adb1508a714dc12aa020a20d813d9ab9f42
DIFF: https://github.com/llvm/llvm-project/commit/9f3b6adb1508a714dc12aa020a20d813d9ab9f42.diff
LOG: [SLP][NFC]Exit early if the graph is empty, NFC
No need to check anything if the graph is empty, just exit early.
Added:
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 b2fc1eb37d4590..53e514766fee81 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -11748,6 +11748,13 @@ bool BoUpSLP::isTreeTinyAndNotFullyVectorizable(bool ForReduction) const {
if (!DebugCounter::shouldExecute(VectorizedGraphs))
return true;
+ // Graph is empty - do nothing.
+ if (VectorizableTree.empty()) {
+ assert(ExternalUses.empty() && "We shouldn't have any external users");
+
+ return true;
+ }
+
// No need to vectorize inserts of gathered values.
if (VectorizableTree.size() == 2 &&
isa<InsertElementInst>(VectorizableTree[0]->Scalars[0]) &&
@@ -11807,10 +11814,6 @@ bool BoUpSLP::isTreeTinyAndNotFullyVectorizable(bool ForReduction) const {
allSameBlock(VectorizableTree.back()->Scalars))
return false;
- assert(VectorizableTree.empty()
- ? ExternalUses.empty()
- : true && "We shouldn't have any external users");
-
// Otherwise, we can't vectorize the tree. It is both tiny and not fully
// vectorizable.
return true;
More information about the llvm-commits
mailing list