[llvm] [CodeGen] Construct SmallVector with ArrayRef (NFC) (PR #135930)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 16 00:56:09 PDT 2025
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/135930
Note that we can drop the call to reserve because the constructor that
takes ArrayRef calls append, which in turn calls reserve.
>From bc19e50865d65b20239c9131d98c27126111e9d4 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Wed, 16 Apr 2025 00:16:03 -0700
Subject: [PATCH] [CodeGen] Construct SmallVector with ArrayRef (NFC)
Note that we can drop the call to reserve because the constructor that
takes ArrayRef calls append, which in turn calls reserve.
---
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index d72be359867ca..8322d243b5bc3 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -24741,10 +24741,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