Skip to content

Conversation

@kazutakahirata
Copy link
Contributor

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

Note that we can drop the call to reserve because the constructor that
takes ArrayRef calls append, which in turn calls reserve.
@kazutakahirata kazutakahirata requested a review from kuhar April 16, 2025 07:56
@llvmbot llvmbot added the llvm:SelectionDAG SelectionDAGISel as well label Apr 16, 2025
@llvmbot
Copy link
Member

llvmbot commented Apr 16, 2025

@llvm/pr-subscribers-llvm-selectiondag

Author: Kazu Hirata (kazutakahirata)

Changes

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


Full diff: https://github.com/llvm/llvm-project/pull/135930.diff

1 Files Affected:

  • (modified) llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (+1-3)
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());

Copy link
Collaborator

@RKSimon RKSimon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM (I'm assuming the CI break is unrelated)

@kazutakahirata kazutakahirata merged commit 81b4fc2 into llvm:main Apr 16, 2025
11 of 13 checks passed
@kazutakahirata kazutakahirata deleted the cleanup_001_SmallVector_ArrayRef_llvm_CodeGen branch April 16, 2025 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

llvm:SelectionDAG SelectionDAGISel as well

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants