[llvm] 82b800e - [SLP][NFC]Limit number of the external uses analysis, NFC.
Alexey Bataev via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 17 14:12:35 PDT 2024
Author: Alexey Bataev
Date: 2024-07-17T14:12:22-07:00
New Revision: 82b800ecb35fb46881aa52000fa40b1b99aa654e
URL: https://github.com/llvm/llvm-project/commit/82b800ecb35fb46881aa52000fa40b1b99aa654e
DIFF: https://github.com/llvm/llvm-project/commit/82b800ecb35fb46881aa52000fa40b1b99aa654e.diff
LOG: [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.
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 1cf2ff89371d9..d88c6307b994b 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -5892,6 +5892,8 @@ void BoUpSLP::buildExternalUses(
}
}
+ if (U && Scalar->hasNUsesOrMore(UsesLimit))
+ U = nullptr;
int FoundLane = Entry->findLaneForValue(Scalar);
LLVM_DEBUG(dbgs() << "SLP: Need to extract:" << *UserInst
<< " from lane " << FoundLane << " from " << *Scalar
@@ -13940,6 +13942,7 @@ Value *BoUpSLP::vectorizeTree(
if (!ScalarsWithNullptrUser.insert(Scalar).second)
continue;
assert((ExternallyUsedValues.count(Scalar) ||
+ Scalar->hasNUsesOrMore(UsesLimit) ||
any_of(Scalar->users(),
[&](llvm::User *U) {
if (ExternalUsesAsGEPs.contains(U))
More information about the llvm-commits
mailing list