[PATCH] D24057: [LoadStoreVectorizer] Change VectorSet to Vector to match head and tail positions. Resolves PR29148.

Alina Sbirlea via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 30 16:34:25 PDT 2016


asbirlea added a comment.

Here's something that bothers me. While it is possible to have a head with multiple tails, (and the Heads and Tails vectors reflect this), there's the "ConsecutiveChain[i] = j;" which forces a single path chain.
Obviously this will miss vectorization opportunities.
e.g. load a[1], load a[1], load a[2], load a[2] will only vectorize one pair, because the second a[1] will point to the same (already vectorized) a[2].
But the alternative of going though all options can end up being prohibitive.
Say you have load a[1] N times, followed by load a[2] N times etc, you'd end up with N^2 comparisons, extending to N^K for a[K].
Is it worth extending this?


================
Comment at: lib/Transforms/Vectorize/LoadStoreVectorizer.cpp:677
@@ -676,3 +676,3 @@
     int I = Head;
-    while (I != -1 && (Tails.count(I) || Heads.count(I))) {
+    while (I != -1 && (is_contained(Tails, I) || is_contained(Heads, I))) {
       if (InstructionsProcessed.count(Instrs[I]))
----------------
ACK.


https://reviews.llvm.org/D24057





More information about the llvm-commits mailing list