[llvm] [GISel][SDAG] Avoid push_back in loops for some shuffle mask handling. (PR #119434)

Amara Emerson via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 10 11:43:54 PST 2024


================
@@ -6173,8 +6173,7 @@ LegalizerHelper::equalizeVectorShuffleLengths(MachineInstr &MI) {
     // Extend mask to match new destination vector size with
     // undef values.
     SmallVector<int, 16> NewMask(Mask);
-    for (unsigned I = MaskNumElts; I < SrcNumElts; ++I)
-      NewMask.push_back(-1);
+    NewMask.resize(SrcNumElts, -1);
----------------
aemerson wrote:

Use the constructor variant as you did in `moreElementsVectorShuffle()`?

https://github.com/llvm/llvm-project/pull/119434


More information about the llvm-commits mailing list