[PATCH] D130778: [NFC] Simplify some conversions from ArrayRef to SmallVector by using to_vector and to_vector_of utilities

Dawid Jurczak via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 4 08:17:42 PDT 2022


yurai007 added inline comments.


================
Comment at: llvm/unittests/Analysis/VectorUtilsTest.cpp:510
   bool validParams(ArrayRef<VFParameter> Parameters) {
-    Shape.Parameters =
-        SmallVector<VFParameter, 8>(Parameters.begin(), Parameters.end());
+    Shape.Parameters = llvm::to_vector<8>(Parameters);
     return Shape.hasValidParameterList();
----------------
dblaikie wrote:
> if there is/we end up with a ctor that takes a range, maybe there should also be an `assign` function that does the same, that would be used here? `Shape.Parameters.assign(Parameters)`
I can think of extending SmallVector with range version of assign, but haven't checked yet how much value it would add excluding this particular usage. If you don't mind I would like to postpone it until rest of SmallVector related patches are submitted.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130778



More information about the llvm-commits mailing list