@@ -193,6 +193,10 @@ static cl::opt<bool>
193193// it has no negative effect on the llvm benchmarks.
194194static const unsigned AliasedCheckLimit = 10;
195195
196+ // Limit of the number of uses for potentially transformed instructions/values,
197+ // used in checks to avoid compile-time explode.
198+ static constexpr int UsesLimit = 8;
199+
196200// Another limit for the alias checks: The maximum distance between load/store
197201// instructions where alias checks are done.
198202// This limit is useful for very large basic blocks.
@@ -941,7 +945,6 @@ static bool isUsedOutsideBlock(Value *V) {
941945 if (!I)
942946 return true;
943947 // Limits the number of uses to save compile time.
944- constexpr int UsesLimit = 8;
945948 return !I->mayReadOrWriteMemory() && !I->hasNUsesOrMore(UsesLimit) &&
946949 all_of(I->users(), [I](User *U) {
947950 auto *IU = dyn_cast<Instruction>(U);
@@ -1285,8 +1288,7 @@ class BoUpSLP {
12851288 // Retruns true if the users of V1 and V2 won't need to be extracted.
12861289 auto AllUsersAreInternal = [U1, U2, this](Value *V1, Value *V2) {
12871290 // Bail out if we have too many uses to save compilation time.
1288- static constexpr unsigned Limit = 8;
1289- if (V1->hasNUsesOrMore(Limit) || V2->hasNUsesOrMore(Limit))
1291+ if (V1->hasNUsesOrMore(UsesLimit) || V2->hasNUsesOrMore(UsesLimit))
12901292 return false;
12911293
12921294 auto AllUsersVectorized = [U1, U2, this](Value *V) {
@@ -5235,8 +5237,7 @@ BoUpSLP::collectUserStores(const BoUpSLP::TreeEntry *TE) const {
52355237 for (unsigned Lane : seq<unsigned>(0, TE->Scalars.size())) {
52365238 Value *V = TE->Scalars[Lane];
52375239 // To save compilation time we don't visit if we have too many users.
5238- static constexpr unsigned UsersLimit = 4;
5239- if (V->hasNUsesOrMore(UsersLimit))
5240+ if (V->hasNUsesOrMore(UsesLimit))
52405241 break;
52415242
52425243 // Collect stores per pointer object.
0 commit comments