Skip to content

Commit a4914dc

Browse files
willirrotateright
authored andcommitted
[SLP] do not traverse constant uses
Walking the use list of a Constant (particularly, ConstantData) is not scalable, since a given constant may be used by many instructinos in many functions in many modules. Differential Revision: https://reviews.llvm.org/D94713
1 parent a0e3091 commit a4914dc

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -987,6 +987,14 @@ class BoUpSLP {
987987
std::array<std::pair<Value *, int>, 2> Values = {{LHS, RHS}};
988988
for (int Idx = 0, IdxE = Values.size(); Idx != IdxE; ++Idx) {
989989
Value *V = Values[Idx].first;
990+
if (isa<Constant>(V)) {
991+
// Since this is a function pass, it doesn't make semantic sense to
992+
// walk the users of a subclass of Constant. The users could be in
993+
// another function, or even another module that happens to be in
994+
// the same LLVMContext.
995+
continue;
996+
}
997+
990998
// Calculate the absolute lane, using the minimum relative lane of LHS
991999
// and RHS as base and Idx as the offset.
9921000
int Ln = std::min(LHS.second, RHS.second) + Idx;

0 commit comments

Comments
 (0)