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

Alexey Bataev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 6 09:44:08 PST 2019


ABataev marked an inline comment as done.
ABataev 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) {
----------------
vdmitrie wrote:
> 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.
Good catch, thanks! It is required to handle the case where 2 other elements are actually UndefvVslues. Just need to add a check for this here.


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