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

Alexey Bataev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 14 04:46:15 PDT 2022


ABataev added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:6313
+          ScalarCost = VL.size() *
+                       ScalarEltCost(std::distance(VL.begin(), find(VL, VL0)));
+        } else {
----------------
RKSimon wrote:
> ABataev wrote:
> > RKSimon wrote:
> > > Is this purely compile time saving?
> > Replaced by 0, since it does not matter.
> I'm not sure if we need to pull them out into separate methods if they're just being called once. But it would help a little for readability if the lambdas weren't embedded in the GetCostDiff calls themselves.
> 
> So:
> ```
> auto ScalarEltCost = [](unsigned Idx)  {...};
> auto VectorCost = [](InstructionCost CommonCost)  {...};
> return GetCostDiff(ScalarEltCost, VectorCost);
> ```
I prefer this approach. I don't want to introduce virtual member functions. Without virtual functions the only approach - generic lambda, which increases codesize.


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