Skip to content

Commit 82b800e

Browse files
committed
[SLP][NFC]Limit number of the external uses analysis, NFC.
BoUpSLP::buildExternalUses runs through all the users of the vectorized scalars, which may require significant amount of time, if there are too many users. Limited the analysis, if there are too many users, all of them are replaced, not individually.
1 parent 1ecffda commit 82b800e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5892,6 +5892,8 @@ void BoUpSLP::buildExternalUses(
58925892
}
58935893
}
58945894

5895+
if (U && Scalar->hasNUsesOrMore(UsesLimit))
5896+
U = nullptr;
58955897
int FoundLane = Entry->findLaneForValue(Scalar);
58965898
LLVM_DEBUG(dbgs() << "SLP: Need to extract:" << *UserInst
58975899
<< " from lane " << FoundLane << " from " << *Scalar
@@ -13940,6 +13942,7 @@ Value *BoUpSLP::vectorizeTree(
1394013942
if (!ScalarsWithNullptrUser.insert(Scalar).second)
1394113943
continue;
1394213944
assert((ExternallyUsedValues.count(Scalar) ||
13945+
Scalar->hasNUsesOrMore(UsesLimit) ||
1394313946
any_of(Scalar->users(),
1394413947
[&](llvm::User *U) {
1394513948
if (ExternalUsesAsGEPs.contains(U))

0 commit comments

Comments
 (0)