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

Anton Rapetov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 17 07:23:06 PST 2021


willir updated this revision to Diff 317218.
willir added a comment.

Correct comment explaining the reason to skip ConstantData, as suggested by
@dexonsmith. At the moment `isa<ConstantData>`, I'm not sure whether using
`isa<Constant>` whould be better here.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D94713/new/

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,14 @@
       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)) {
+          // 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;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D94713.317218.patch
Type: text/x-patch
Size: 955 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210117/c90eeec9/attachment.bin>


More information about the llvm-commits mailing list