[llvm] 65c7ea7 - SLPVectorizer: Avoid looking at uselists of constants (#134578)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 7 02:52:14 PDT 2025
Author: Matt Arsenault
Date: 2025-04-07T16:52:11+07:00
New Revision: 65c7ea713e0b411a707b0ccac374bda9f30234ea
URL: https://github.com/llvm/llvm-project/commit/65c7ea713e0b411a707b0ccac374bda9f30234ea
DIFF: https://github.com/llvm/llvm-project/commit/65c7ea713e0b411a707b0ccac374bda9f30234ea.diff
LOG: SLPVectorizer: Avoid looking at uselists of constants (#134578)
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 31c684e16f051..94c0289807245 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -6273,7 +6273,7 @@ BoUpSLP::getReorderingData(const TreeEntry &TE, bool TopToBottom,
SmallVector<Instruction *> UserBVHead(TE.Scalars.size());
for (auto [I, V] : zip(UserBVHead, TE.Scalars)) {
- if (!V->hasNUsesOrMore(1))
+ if (isa<Constant>(V) || !V->hasNUsesOrMore(1))
continue;
auto *II = dyn_cast<InsertElementInst>(*V->user_begin());
if (!II)
@@ -13433,7 +13433,7 @@ bool BoUpSLP::isTreeTinyAndNotFullyVectorizable(bool ForReduction) const {
allSameBlock(VectorizableTree.front()->Scalars));
if (any_of(VectorizableTree, [&](const std::unique_ptr<TreeEntry> &TE) {
return TE->isGather() && all_of(TE->Scalars, [&](Value *V) {
- return isa<ExtractElementInst, UndefValue>(V) ||
+ return isa<ExtractElementInst, Constant>(V) ||
(IsAllowedSingleBVNode &&
!V->hasNUsesOrMore(UsesLimit) &&
any_of(V->users(), IsaPred<InsertElementInst>));
@@ -19459,7 +19459,7 @@ bool BoUpSLP::collectValuesToDemote(
return FinalAnalysis();
if (any_of(E.Scalars, [&](Value *V) {
- return !all_of(V->users(), [=](User *U) {
+ return !isa<Constant>(V) && !all_of(V->users(), [=](User *U) {
return isVectorized(U) ||
(E.Idx == 0 && UserIgnoreList &&
UserIgnoreList->contains(U)) ||
More information about the llvm-commits
mailing list