[PATCH] D115757: [SLP]Generalize cost model.

Valeriy Dmitriev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 13 14:41:43 PDT 2022


vdmitrie added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:6331
+  const unsigned Sz = VL.size();
+  auto &&GetCostDiff =
+      [this, E, Sz, CommonCost,
----------------
ABataev wrote:
> vdmitrie wrote:
> > ABataev wrote:
> > > vdmitrie wrote:
> > > > Do you have a specific reason to keep this as lambda(lambda(...),lambda(...)) design?
> > > > I mean this would look much better if you make one more step and outline this into a separate class  (for example CostDifferentiator) with dedicated methods instead of stuffing code with tons of lambdas.
> > > It will still have lambdas for each particular opcode
> > Why? It is not prohibited to have dedicated method in the class for each particular opcode. 
> > 
> > 
> It still will be a switch with functions calls, which have the pretty similar loops and other processing. This what exactly I want to avoid - duplicate of the code.
I can't agree with statement that it will be a duplication of code. Organized differently - yes.
IMO it's always worth investing time in developing a better interface.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115757



More information about the llvm-commits mailing list