Skip to content

Commit 65c7ea7

Browse files
authored
SLPVectorizer: Avoid looking at uselists of constants (#134578)
1 parent ec40027 commit 65c7ea7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)