[PATCH] D126885: [SLP]Cost for a constant buildvector.

Valeriy Dmitriev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 3 14:47:56 PDT 2022


vdmitrie added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:5783
+           E->UserTreeIndices.front().UserTE->isAltShuffle())
+              ? 0
+              : E->UserTreeIndices.front().UserTE->getOpcode();
----------------
ABataev wrote:
> vdmitrie wrote:
> > Just wondering is that possible for UserTreeIndices to be empty here? AFAIU it can be for root only but constants do not seed vtree.
> > if alternate opcodes are for shl/shr but shift value is splat it is still can be immediate for both of them.
> > 
> 1. If constants are reduced values in reduction ops.
> 2. That's why there is a TODO above.
okay. Although I believe it is not SLP vectorizer job to do constant folding.


================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:5802
+      } else {
+        InstructionCost ScalarCost = 0;
+        for (Value *V : VL) {
----------------
ABataev wrote:
> vdmitrie wrote:
> > drop it?
> What do you mean?
Drop extra definition of ScalarCost.
Otherwise loop at line 5807 is updating variable from 5802,  but it is not used.
LIne 5811 will subtract one defined at 5795.



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D126885



More information about the llvm-commits mailing list