[PATCH] D102675: [SLP] Fix "gathering" of vector values

Alexey Bataev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 24 04:56:45 PDT 2021


ABataev added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:3693-3695
+    // No cost for "gathering" already vector value
+    if (isa<FixedVectorType>(VL[0]->getType()))
+      return 0;
----------------
anton-afanasyev wrote:
> ABataev wrote:
> > Not sure we should return `0` here, maybe better to return some max cost, like `INT_MAX`?
> There is no difference for now (the only one is compile time). We could also just prohibit marking `NeedToGather` for vector node (it could be done while checking for ephemeral values only).
> 
> But I've done it this way since it looks more transparent and also we could use zero cost for the future cases when/if such `NeedToGather` vector node is not the only member of tree and whole tree vectorization is beneficial.
I think it is better to use `TTI::TCC_Expensive` to mark it explicitly as an expensive operation. Or even `invalid` cost, if possible.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102675



More information about the llvm-commits mailing list