[PATCH] D94713: Do not traverse ConstantData use-list in SLPVectorizer

Anton Rapetov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 14 12:34:15 PST 2021


willir created this revision.
willir added a reviewer: dexonsmith.
Herald added a subscriber: hiraditya.
willir requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D94713

Files:
  llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp


Index: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
===================================================================
--- llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -986,6 +986,13 @@
       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<ConstantData>(V)) {
+          // 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.
+          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;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D94713.316748.patch
Type: text/x-patch
Size: 899 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210114/4da676a6/attachment.bin>


More information about the llvm-commits mailing list