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

Sander de Smalen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 26 09:14:06 PST 2020


sdesmalen added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:5414
+
+  std::pair<float, unsigned> MinCost = {ExpectedCost, 1};
+  const float ScalarCost = ExpectedCost;
----------------
`std::pair<unsigned, unsigned>` 


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:5415
+  std::pair<float, unsigned> MinCost = {ExpectedCost, 1};
+  const float ScalarCost = ExpectedCost;
 
----------------
`std::pair<unsigned, unsigned> ScalarCost = {ExpectedCost, 1}`


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:5422
     // evaluation.
-    Cost = std::numeric_limits<float>::max();
+    MinCost.first = std::numeric_limits<float>::max();
   }
----------------
`std::numeric_limits<unsigned>::max()` ?



================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:5435
     VectorizationCostTy C = expectedCost(ElementCount::getFixed(i));
-    float VectorCost = C.first / (float)i;
+    std::pair<float, unsigned> VectorCost = {C.first, i};
     LLVM_DEBUG(dbgs() << "LV: Vector loop of width " << i
----------------
`std::pair<unsigned, unsigned>` (that also allows removing the cast on line 5461)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D92177



More information about the llvm-commits mailing list