[PATCH] D92177: [NFC][InstructionCost] Refactor LoopVectorizationCostModel::selectVectorizationFactor

Sander de Smalen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 27 07:48:28 PST 2020


sdesmalen added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:5437
     LLVM_DEBUG(dbgs() << "LV: Vector loop of width " << i
-                      << " costs: " << (int)VectorCost << ".\n");
+                      << " costs: " << (int)(C.first / i) << ".\n");
     if (!C.second && !ForceVectorization) {
----------------
nit: cast is no longer necessary?


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:5460
+  LLVM_DEBUG(dbgs() << "LV: Selecting VF: " << MinCost.second << ".\n");
+  ElementCount EC = ElementCount::getFixed(MinCost.second);
+  return {EC, MinCost.first};
----------------
nit: `return {ElementCount::getFixed(MinCost.second), MinCost.first};`


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:5415
+  std::pair<float, unsigned> MinCost = {ExpectedCost, 1};
+  const float ScalarCost = ExpectedCost;
 
----------------
sdesmalen wrote:
> `std::pair<unsigned, unsigned> ScalarCost = {ExpectedCost, 1}`
I think you missed this one. This would remove the need for `{ScalarCost, 1}` on line 5456.


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

https://reviews.llvm.org/D92177



More information about the llvm-commits mailing list