[llvm] [GISel][SDAG] Avoid push_back in loops for some shuffle mask handling. (PR #119434)
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 10 15:12:29 PST 2024
================
@@ -6478,12 +6476,9 @@ SDValue DAGTypeLegalizer::WidenVecRes_VECTOR_REVERSE(SDNode *N) {
// Use VECTOR_SHUFFLE to combine new vector from 'ReverseVal' for
// fixed-vectors.
- SmallVector<int, 16> Mask;
- for (unsigned i = 0; i != VTNumElts; ++i) {
- Mask.push_back(IdxVal + i);
- }
- for (unsigned i = VTNumElts; i != WidenNumElts; ++i)
- Mask.push_back(-1);
+ SmallVector<int, 16> Mask(VTNumElts, -1);
+ for (unsigned i = 0; i != VTNumElts; ++i)
----------------
RKSimon wrote:
Use std::iota?
https://github.com/llvm/llvm-project/pull/119434
More information about the llvm-commits
mailing list