Skip to content

Commit 73d90ec

Browse files
committed
[SLP][NFC]Consider non-profitable trees with only phis, gathers, splits and small nodes with reuses
Improves compile time for non-profitable cases. Fixes llvm#135965
1 parent 12a4ec6 commit 73d90ec

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13949,6 +13949,19 @@ bool BoUpSLP::isTreeTinyAndNotFullyVectorizable(bool ForReduction) const {
1394913949
}))
1395013950
return true;
1395113951

13952+
// If the tree contains only phis, buildvectors, split nodes and
13953+
// small nodes with reuses, we can skip it.
13954+
if (!ForReduction && !SLPCostThreshold.getNumOccurrences() &&
13955+
all_of(VectorizableTree, [](const std::unique_ptr<TreeEntry> &TE) {
13956+
return TE->State == TreeEntry::SplitVectorize ||
13957+
(TE->isGather() &&
13958+
none_of(TE->Scalars, IsaPred<ExtractElementInst>)) ||
13959+
(TE->hasState() && (TE->getOpcode() == Instruction::PHI ||
13960+
(!TE->ReuseShuffleIndices.empty() &&
13961+
TE->Scalars.size() == 2)));
13962+
}))
13963+
return true;
13964+
1395213965
// We can vectorize the tree if its size is greater than or equal to the
1395313966
// minimum size specified by the MinTreeSize command line option.
1395413967
if (VectorizableTree.size() >= MinTreeSize)

0 commit comments

Comments
 (0)