[PATCH] D14829: [SLP] Vectorize gather-like idioms ending at non-consecutive loads.

Ayal Zaks via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 8 05:03:17 PST 2016


Ayal added inline comments.

================
Comment at: lib/Transforms/Vectorize/SLPVectorizer.cpp:4331
@@ +4330,3 @@
+        auto *Delta = SE->getMinusSCEV(GEP, SE->getSCEV(Entry.second[J]));
+        if (Delta == SizeSCEV || Delta == NegSizeSCEV) {
+          AdjacentGEPs.insert(Entry.second[I]);
----------------
How about simply checking if (isa<SCEVConstant>(Delta)) instead? As said, If one index is easily derived from the other, the two are poor candidates for parallel independent computation. This holds not only when they're exactly adjacent.

Would be good to add tests to make sure this works as intended.

Note that each such index may still be a good candidate, if grouped together with some other, independent indices. Discarding both from consideration may be reasonable, certainly compile-time-wise. The better guidance for such patterns is top-down, as you noted at the beginning.

================
Comment at: lib/Transforms/Vectorize/SLPVectorizer.cpp:4332-4334
@@ +4331,5 @@
+        if (Delta == SizeSCEV || Delta == NegSizeSCEV) {
+          AdjacentGEPs.insert(Entry.second[I]);
+          AdjacentGEPs.insert(Entry.second[J]);
+          AllAdjacent = AdjacentGEPs.size() + 2 > Entry.second.size();
+        }
----------------
You could, alternatively, remove correlated GEPs from a set of all current candidates, initialized to all non-nullified GEPs. As long as this set has at-least two remaining candidates.


http://reviews.llvm.org/D14829





More information about the llvm-commits mailing list