[llvm] 46ad66b - [SLP][NFC]Use 'llvm::copy' instead of element-by-elemen copying.

Alexey Bataev via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 17 12:10:16 PST 2021


Author: Alexey Bataev
Date: 2021-12-17T12:07:59-08:00
New Revision: 46ad66b81781c219c41468eefda41d5502825711

URL: https://github.com/llvm/llvm-project/commit/46ad66b81781c219c41468eefda41d5502825711
DIFF: https://github.com/llvm/llvm-project/commit/46ad66b81781c219c41468eefda41d5502825711.diff

LOG: [SLP][NFC]Use 'llvm::copy' instead of element-by-elemen copying.

Added: 
    

Modified: 
    llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
index b18ddba3088b4..6346406b091a4 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -1966,9 +1966,10 @@ class BoUpSLP {
       if (Operands.size() < OpIdx + 1)
         Operands.resize(OpIdx + 1);
       assert(Operands[OpIdx].empty() && "Already resized?");
-      Operands[OpIdx].resize(Scalars.size());
-      for (unsigned Lane = 0, E = Scalars.size(); Lane != E; ++Lane)
-        Operands[OpIdx][Lane] = OpVL[Lane];
+      assert(OpVL.size() <= Scalars.size() &&
+             "Number of operands is greater than the number of scalars.");
+      Operands[OpIdx].resize(OpVL.size());
+      copy(OpVL, Operands[OpIdx].begin());
     }
 
     /// Set the operands of this bundle in their original order.


        


More information about the llvm-commits mailing list