@@ -6273,7 +6273,7 @@ BoUpSLP::getReorderingData(const TreeEntry &TE, bool TopToBottom,
6273
6273
6274
6274
SmallVector<Instruction *> UserBVHead(TE.Scalars.size());
6275
6275
for (auto [I, V] : zip(UserBVHead, TE.Scalars)) {
6276
- if (!V->hasNUsesOrMore(1))
6276
+ if (isa<Constant>(V) || !V->hasNUsesOrMore(1))
6277
6277
continue;
6278
6278
auto *II = dyn_cast<InsertElementInst>(*V->user_begin());
6279
6279
if (!II)
@@ -13433,7 +13433,7 @@ bool BoUpSLP::isTreeTinyAndNotFullyVectorizable(bool ForReduction) const {
13433
13433
allSameBlock(VectorizableTree.front()->Scalars));
13434
13434
if (any_of(VectorizableTree, [&](const std::unique_ptr<TreeEntry> &TE) {
13435
13435
return TE->isGather() && all_of(TE->Scalars, [&](Value *V) {
13436
- return isa<ExtractElementInst, UndefValue >(V) ||
13436
+ return isa<ExtractElementInst, Constant >(V) ||
13437
13437
(IsAllowedSingleBVNode &&
13438
13438
!V->hasNUsesOrMore(UsesLimit) &&
13439
13439
any_of(V->users(), IsaPred<InsertElementInst>));
@@ -19459,7 +19459,7 @@ bool BoUpSLP::collectValuesToDemote(
19459
19459
return FinalAnalysis();
19460
19460
19461
19461
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) {
19463
19463
return isVectorized(U) ||
19464
19464
(E.Idx == 0 && UserIgnoreList &&
19465
19465
UserIgnoreList->contains(U)) ||
0 commit comments