[PATCH] [SLPVectorization] Enhance Ability to Vectorize Horizontal Reductions from Consecutive Loads

Michael Zolotukhin mzolotukhin at apple.com
Fri Dec 19 15:53:40 PST 2014


Hi Suyog,

Thanks for working on this, please find comments from me inline.

Michael


REPOSITORY
  rL LLVM

================
Comment at: lib/Transforms/Vectorize/SLPVectorizer.cpp:1244
@@ -1236,2 +1243,3 @@
         reorderInputsAccordingToOpcode(VL, Left, Right);
+        reorderIfConsecutiveLoads (Left, Right);
         buildTree_rec(Left, Depth + 1);
----------------
No need in whitespace before the brace.

================
Comment at: lib/Transforms/Vectorize/SLPVectorizer.cpp:1838-1841
@@ +1837,6 @@
+      return;
+    if (!(isConsecutiveAccess(Left[i], Right[i])))
+      continue;
+    else
+      std::swap(Left[i + 1], Right[i]);
+  }
----------------
I think we should only swap if `Left[i]` and `Left[i+1]` are consecutive - that's the only case we get something from this reordering.

In your current approach we might lose consecutiveness in `Right[i]` and `Right[i+1]` by swapping `Left[i+1]` and `Right[i]` even if later on `Left[i]` and `Left[i+1]` won't be consecutive.

================
Comment at: lib/Transforms/Vectorize/SLPVectorizer.cpp:2077
@@ -2052,1 +2076,3 @@
         reorderInputsAccordingToOpcode(E->Scalars, LHSVL, RHSVL);
+        reorderIfConsecutiveLoads (LHSVL, RHSVL);
+      }
----------------
Redundant whitespace here too.

http://reviews.llvm.org/D6675

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list