nir: Assert that nir_ssa_for_src components matches

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>
This commit is contained in:
Alyssa Rosenzweig 2023-08-12 16:36:52 -04:00
parent 8552311343
commit eff5e18714

View 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;
}
/**