nir: Assert that nir_ssa_for_src components matches
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>
Sat, 12 Aug 2023 20:36:52 +0000 (16:36 -0400)
committerAlyssa Rosenzweig <alyssa@rosenzweig.io>
Tue, 15 Aug 2023 15:59:03 +0000 (11:59 -0400)
In prep for removing the helper.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24654>

src/compiler/nir/nir_builder.c

index 713864b..cbd0623 100644 (file)
@@ -343,19 +343,10 @@ nir_vec_scalars(nir_builder *build, nir_scalar *comp, unsigned num_components)
  * See nir_ssa_for_alu_src() for alu instructions.
  */
 nir_def *
-nir_ssa_for_src(nir_builder *build, nir_src src, int num_components)
+nir_ssa_for_src(nir_builder *build, nir_src src, ASSERTED int num_components)
 {
-   if (src.ssa->num_components == num_components)
-      return src.ssa;
-
-   assert((unsigned)num_components <= nir_src_num_components(src));
-
-   nir_alu_src alu = { NIR_SRC_INIT };
-   alu.src = src;
-   for (int j = 0; j < NIR_MAX_VEC_COMPONENTS; j++)
-      alu.swizzle[j] = j;
-
-   return nir_mov_alu(build, alu, num_components);
+   assert(src.ssa->num_components == num_components && "now required");
+   return src.ssa;
 }
 
 /**