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

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 14 01:01:43 PDT 2022


RKSimon added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:6313
+          ScalarCost = VL.size() *
+                       ScalarEltCost(std::distance(VL.begin(), find(VL, VL0)));
+        } else {
----------------
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);
```


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