[llvm-branch-commits] [llvm] a4914dc - [SLP] do not traverse constant uses
Sanjay Patel via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Fri Jan 22 05:19:11 PST 2021
Author: Anton Rapetov
Date: 2021-01-22T08:14:09-05:00
New Revision: a4914dc1f2b4a49cf488d3be7a01fe7238c889d8
URL: https://github.com/llvm/llvm-project/commit/a4914dc1f2b4a49cf488d3be7a01fe7238c889d8
DIFF: https://github.com/llvm/llvm-project/commit/a4914dc1f2b4a49cf488d3be7a01fe7238c889d8.diff
LOG: [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
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 cee388e62bf2..78ce4870588c 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -987,6 +987,14 @@ class BoUpSLP {
std::array<std::pair<Value *, int>, 2> Values = {{LHS, RHS}};
for (int Idx = 0, IdxE = Values.size(); Idx != IdxE; ++Idx) {
Value *V = Values[Idx].first;
+ if (isa<Constant>(V)) {
+ // Since this is a function pass, it doesn't make semantic sense to
+ // walk the users of a subclass of Constant. The users could be in
+ // another function, or even another module that happens to be in
+ // the same LLVMContext.
+ continue;
+ }
+
// Calculate the absolute lane, using the minimum relative lane of LHS
// and RHS as base and Idx as the offset.
int Ln = std::min(LHS.second, RHS.second) + Idx;
More information about the llvm-branch-commits
mailing list