nir: Drop unused argument from nir_ssa_dest_init_for_type

Similar to nir_ssa_dest_init, but with fewer call sites to churn through.

This was done with the help of Coccinelle:

   @@
   expression A, B, C, D;
   @@

   -nir_ssa_dest_init_for_type(A, B, C, D);
   +nir_ssa_dest_init_for_type(A, B, C);

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23078>
This commit is contained in:
Alyssa Rosenzweig
2023-05-17 09:26:20 -04:00
committed by Marge Bot
parent 01e9ee79f7
commit c7861fe1f2
6 changed files with 10 additions and 16 deletions

View File

@@ -4455,8 +4455,7 @@ void nir_ssa_def_init(nir_instr *instr, nir_ssa_def *def,
unsigned num_components, unsigned bit_size);
static inline void
nir_ssa_dest_init_for_type(nir_instr *instr, nir_dest *dest,
const struct glsl_type *type,
const char *name)
const struct glsl_type *type)
{
assert(glsl_type_is_vector_or_scalar(type));
nir_ssa_dest_init(instr, dest, glsl_get_components(type),

View File

@@ -173,8 +173,7 @@ lower_system_value_instr(nir_builder *b, nir_instr *instr, void *_state)
nir_intrinsic_op op =
nir_intrinsic_from_system_value(var->data.location);
nir_intrinsic_instr *load = nir_intrinsic_instr_create(b->shader, op);
nir_ssa_dest_init_for_type(&load->instr, &load->dest,
var->type, NULL);
nir_ssa_dest_init_for_type(&load->instr, &load->dest, var->type);
load->num_components = load->dest.ssa.num_components;
nir_builder_instr_insert(b, &load->instr);
return &load->dest.ssa;

View File

@@ -80,7 +80,7 @@ vtn_handle_amd_shader_ballot_instruction(struct vtn_builder *b, SpvOp ext_opcode
const struct glsl_type *dest_type = vtn_get_type(b, w[1])->type;
nir_intrinsic_instr *intrin = nir_intrinsic_instr_create(b->nb.shader, op);
nir_ssa_dest_init_for_type(&intrin->instr, &intrin->dest, dest_type, NULL);
nir_ssa_dest_init_for_type(&intrin->instr, &intrin->dest, dest_type);
if (nir_intrinsic_infos[op].src_components[0] == 0)
intrin->num_components = intrin->dest.ssa.num_components;

View File

@@ -52,8 +52,7 @@ vtn_build_subgroup_instr(struct vtn_builder *b,
nir_intrinsic_instr *intrin =
nir_intrinsic_instr_create(b->nb.shader, nir_op);
nir_ssa_dest_init_for_type(&intrin->instr, &intrin->dest,
dst->type, NULL);
nir_ssa_dest_init_for_type(&intrin->instr, &intrin->dest, dst->type);
intrin->num_components = intrin->dest.ssa.num_components;
intrin->src[0] = nir_src_for_ssa(src0->def);
@@ -82,8 +81,7 @@ vtn_handle_subgroup(struct vtn_builder *b, SpvOp opcode,
"OpGroupNonUniformElect must return a Bool");
nir_intrinsic_instr *elect =
nir_intrinsic_instr_create(b->nb.shader, nir_intrinsic_elect);
nir_ssa_dest_init_for_type(&elect->instr, &elect->dest,
dest_type->type, NULL);
nir_ssa_dest_init_for_type(&elect->instr, &elect->dest, dest_type->type);
nir_builder_instr_insert(&b->nb, &elect->instr);
vtn_push_nir_ssa(b, w[2], &elect->dest.ssa);
break;
@@ -117,7 +115,7 @@ vtn_handle_subgroup(struct vtn_builder *b, SpvOp opcode,
intrin->src[1] = nir_src_for_ssa(nir_load_subgroup_invocation(&b->nb));
nir_ssa_dest_init_for_type(&intrin->instr, &intrin->dest,
dest_type->type, NULL);
dest_type->type);
nir_builder_instr_insert(&b->nb, &intrin->instr);
vtn_push_nir_ssa(b, w[2], &intrin->dest.ssa);
@@ -172,7 +170,7 @@ vtn_handle_subgroup(struct vtn_builder *b, SpvOp opcode,
intrin->src[1] = nir_src_for_ssa(src1);
nir_ssa_dest_init_for_type(&intrin->instr, &intrin->dest,
dest_type->type, NULL);
dest_type->type);
nir_builder_instr_insert(&b->nb, &intrin->instr);
vtn_push_nir_ssa(b, w[2], &intrin->dest.ssa);
@@ -265,7 +263,7 @@ vtn_handle_subgroup(struct vtn_builder *b, SpvOp opcode,
intrin->num_components = src0->num_components;
intrin->src[0] = nir_src_for_ssa(src0);
nir_ssa_dest_init_for_type(&intrin->instr, &intrin->dest,
dest_type->type, NULL);
dest_type->type);
nir_builder_instr_insert(&b->nb, &intrin->instr);
vtn_push_nir_ssa(b, w[2], &intrin->dest.ssa);

View File

@@ -2802,8 +2802,7 @@ vtn_handle_variables(struct vtn_builder *b, SpvOp opcode,
nir_intrinsic_instr_create(b->nb.shader,
nir_intrinsic_load_deref_block_intel);
load->src[0] = nir_src_for_ssa(&src->dest.ssa);
nir_ssa_dest_init_for_type(&load->instr, &load->dest,
res_type->type, NULL);
nir_ssa_dest_init_for_type(&load->instr, &load->dest, res_type->type);
load->num_components = load->dest.ssa.num_components;
nir_builder_instr_insert(&b->nb, &load->instr);

View File

@@ -92,8 +92,7 @@ implement_atomic_builtin(nir_function *func, nir_atomic_op atomic_op,
atomic->src[i] = nir_src_for_ssa(src);
}
nir_ssa_dest_init_for_type(&atomic->instr, &atomic->dest,
data_type, NULL);
nir_ssa_dest_init_for_type(&atomic->instr, &atomic->dest, data_type);
nir_builder_instr_insert(&b, &atomic->instr);
nir_store_deref(&b, ret, &atomic->dest.ssa, ~0);