Skip to content

Commit 9f3b6ad

Browse files
committed
[SLP][NFC]Exit early if the graph is empty, NFC
No need to check anything if the graph is empty, just exit early.
1 parent 83f92c3 commit 9f3b6ad

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11748,6 +11748,13 @@ bool BoUpSLP::isTreeTinyAndNotFullyVectorizable(bool ForReduction) const {
1174811748
if (!DebugCounter::shouldExecute(VectorizedGraphs))
1174911749
return true;
1175011750

11751+
// Graph is empty - do nothing.
11752+
if (VectorizableTree.empty()) {
11753+
assert(ExternalUses.empty() && "We shouldn't have any external users");
11754+
11755+
return true;
11756+
}
11757+
1175111758
// No need to vectorize inserts of gathered values.
1175211759
if (VectorizableTree.size() == 2 &&
1175311760
isa<InsertElementInst>(VectorizableTree[0]->Scalars[0]) &&
@@ -11807,10 +11814,6 @@ bool BoUpSLP::isTreeTinyAndNotFullyVectorizable(bool ForReduction) const {
1180711814
allSameBlock(VectorizableTree.back()->Scalars))
1180811815
return false;
1180911816

11810-
assert(VectorizableTree.empty()
11811-
? ExternalUses.empty()
11812-
: true && "We shouldn't have any external users");
11813-
1181411817
// Otherwise, we can't vectorize the tree. It is both tiny and not fully
1181511818
// vectorizable.
1181611819
return true;

0 commit comments

Comments
 (0)