[llvm] 81b4fc2 - [CodeGen] Construct SmallVector with ArrayRef (NFC) (#135930)

via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 16 08:37:59 PDT 2025


Author: Kazu Hirata
Date: 2025-04-16T08:37:56-07:00
New Revision: 81b4fc2bedc411c257fdf24540318e24fe669b8b

URL: https://github.com/llvm/llvm-project/commit/81b4fc2bedc411c257fdf24540318e24fe669b8b
DIFF: https://github.com/llvm/llvm-project/commit/81b4fc2bedc411c257fdf24540318e24fe669b8b.diff

LOG: [CodeGen] Construct SmallVector with ArrayRef (NFC) (#135930)

Note that we can drop the call to reserve because the constructor that
takes ArrayRef calls append, which in turn calls reserve.

Added: 
    

Modified: 
    llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index ab8e18267f3f5..b175e35385ec6 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -24747,10 +24747,8 @@ static SDValue combineConcatVectorOfShuffleAndItsOperands(
 
   // We are going to pad the shuffle operands, so any indice, that was picking
   // from the second operand, must be adjusted.
-  SmallVector<int, 16> AdjustedMask;
-  AdjustedMask.reserve(SVN->getMask().size());
+  SmallVector<int, 16> AdjustedMask(SVN->getMask());
   assert(SVN->getOperand(1).isUndef() && "Expected unary shuffle!");
-  append_range(AdjustedMask, SVN->getMask());
 
   // Identity masks for the operands of the (padded) shuffle.
   SmallVector<int, 32> IdentityMask(2 * OpVT.getVectorNumElements());


        


More information about the llvm-commits mailing list