nir/instr_set: replace nir_instr_get_def_def with nir_instr_def

Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32235>
This commit is contained in:
Georg Lehmann 2024-11-19 22:45:12 +01:00 committed by Marge Bot
parent 4299809321
commit 7097b705b5

View File

@ -740,29 +740,6 @@ nir_instrs_equal(const nir_instr *instr1, const nir_instr *instr2)
unreachable("All cases in the above switch should return");
}
static nir_def *
nir_instr_get_def_def(nir_instr *instr)
{
switch (instr->type) {
case nir_instr_type_alu:
return &nir_instr_as_alu(instr)->def;
case nir_instr_type_deref:
return &nir_instr_as_deref(instr)->def;
case nir_instr_type_load_const:
return &nir_instr_as_load_const(instr)->def;
case nir_instr_type_phi:
return &nir_instr_as_phi(instr)->def;
case nir_instr_type_intrinsic:
return &nir_instr_as_intrinsic(instr)->def;
case nir_instr_type_tex:
return &nir_instr_as_tex(instr)->def;
case nir_instr_type_debug_info:
return &nir_instr_as_debug_info(instr)->def;
default:
unreachable("We never ask for any of these");
}
}
static bool
cmp_func(const void *data1, const void *data2)
{
@ -796,8 +773,8 @@ nir_instr_set_add_or_rewrite(struct set *instr_set, nir_instr *instr,
if (!cond_function || cond_function(match, instr)) {
/* rewrite instruction if condition is matched */
nir_def *def = nir_instr_get_def_def(instr);
nir_def *new_def = nir_instr_get_def_def(match);
nir_def *def = nir_instr_def(instr);
nir_def *new_def = nir_instr_def(match);
/* It's safe to replace an exact instruction with an inexact one as
* long as we make it exact. If we got here, the two instructions are