[PATCH] D57059: [SLP] Initial support for the vectorization of the non-power-of-2 vectors.

Valeriy Dmitriev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 6 09:27:55 PST 2019


vdmitrie added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:3299
   CurrentOrder.assign(E, E + 1);
-  unsigned I = 0;
-  for (; I < E; ++I) {
+  unsigned I = 0, End = std::min(NElts, E);
+  for (; I < End; ++I) {
----------------
What is reasoning for this min?
Imagine VL[0] and VL[1] are extracts of two subsequent elements from the same vector of size 2
and VL[2], VL[3] are extracts from another vector (which can even be of different size). NElts will be assigned 2 based on VL[0] while VL size is 4. The for loop at line 3300 will not visit 3th and 4th elements of the VL and final answer turns out "true"  which is obviously incorrect as we must gather these extracts.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D57059





More information about the llvm-commits mailing list