@@ -6273,7 +6273,7 @@ BoUpSLP::getReorderingData(const TreeEntry &TE, bool TopToBottom,
62736273
62746274 SmallVector<Instruction *> UserBVHead(TE.Scalars.size());
62756275 for (auto [I, V] : zip(UserBVHead, TE.Scalars)) {
6276- if (!V->hasNUsesOrMore(1))
6276+ if (isa<Constant>(V) || !V->hasNUsesOrMore(1))
62776277 continue;
62786278 auto *II = dyn_cast<InsertElementInst>(*V->user_begin());
62796279 if (!II)
@@ -13433,7 +13433,7 @@ bool BoUpSLP::isTreeTinyAndNotFullyVectorizable(bool ForReduction) const {
1343313433 allSameBlock(VectorizableTree.front()->Scalars));
1343413434 if (any_of(VectorizableTree, [&](const std::unique_ptr<TreeEntry> &TE) {
1343513435 return TE->isGather() && all_of(TE->Scalars, [&](Value *V) {
13436- return isa<ExtractElementInst, UndefValue >(V) ||
13436+ return isa<ExtractElementInst, Constant >(V) ||
1343713437 (IsAllowedSingleBVNode &&
1343813438 !V->hasNUsesOrMore(UsesLimit) &&
1343913439 any_of(V->users(), IsaPred<InsertElementInst>));
@@ -19459,7 +19459,7 @@ bool BoUpSLP::collectValuesToDemote(
1945919459 return FinalAnalysis();
1946019460
1946119461 if (any_of(E.Scalars, [&](Value *V) {
19462- return !all_of(V->users(), [=](User *U) {
19462+ return !isa<Constant>(V) && ! all_of(V->users(), [=](User *U) {
1946319463 return isVectorized(U) ||
1946419464 (E.Idx == 0 && UserIgnoreList &&
1946519465 UserIgnoreList->contains(U)) ||
0 commit comments