nir: Drop unused argument from nir_ssa_dest_init_for_type
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>
Wed, 17 May 2023 13:26:20 +0000 (09:26 -0400)
committerMarge Bot <emma+marge@anholt.net>
Wed, 17 May 2023 23:46:16 +0000 (23:46 +0000)
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>

src/compiler/nir/nir.h
src/compiler/nir/nir_lower_system_values.c
src/compiler/spirv/vtn_amd.c
src/compiler/spirv/vtn_subgroup.c
src/compiler/spirv/vtn_variables.c
src/intel/compiler/brw_kernel.c

index e5a37fb..8e0c73b 100644 (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),
index 4e443c3..3165b0c 100644 (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;
index 12dd3a0..e1e29c9 100644 (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;
 
index d3b5521..eef50f2 100644 (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);
index d752f35..4cbd667 100644 (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);
 
index acf0d2a..2776d6e 100644 (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);