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

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 10 15:56:04 PST 2024


================
@@ -6478,12 +6476,8 @@ 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(WidenNumElts, -1);
----------------
topperc wrote:

This code isn't tested because VECTOR_REVERSE is converted to a generic VECTOR_SHUFFLE for fixed vectors.

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


More information about the llvm-commits mailing list