From c69eb8dfd72f49d35f480aee2f144fec219f210f Mon Sep 17 00:00:00 2001 From: Faith Ekstrand Date: Mon, 14 Aug 2023 10:15:06 -0500 Subject: [PATCH] nir/dce: Stop passing around nir_dest Reviewed-by: Alyssa Rosenzweig Part-of: --- src/compiler/nir/nir_opt_dce.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/compiler/nir/nir_opt_dce.c b/src/compiler/nir/nir_opt_dce.c index 118c677..9b27a5c 100644 --- a/src/compiler/nir/nir_opt_dce.c +++ b/src/compiler/nir/nir_opt_dce.c @@ -28,9 +28,9 @@ #include "nir.h" static bool -is_dest_live(const nir_dest *dest, BITSET_WORD *defs_live) +is_def_live(const nir_def *def, BITSET_WORD *defs_live) { - return BITSET_TEST(defs_live, dest->ssa.index); + return BITSET_TEST(defs_live, def->index); } static bool @@ -60,38 +60,38 @@ is_live(BITSET_WORD *defs_live, nir_instr *instr) return true; case nir_instr_type_alu: { nir_alu_instr *alu = nir_instr_as_alu(instr); - return is_dest_live(&alu->dest.dest, defs_live); + return is_def_live(&alu->dest.dest.ssa, defs_live); } case nir_instr_type_deref: { nir_deref_instr *deref = nir_instr_as_deref(instr); - return is_dest_live(&deref->dest, defs_live); + return is_def_live(&deref->dest.ssa, defs_live); } case nir_instr_type_intrinsic: { nir_intrinsic_instr *intrin = nir_instr_as_intrinsic(instr); const nir_intrinsic_info *info = &nir_intrinsic_infos[intrin->intrinsic]; return !(info->flags & NIR_INTRINSIC_CAN_ELIMINATE) || - (info->has_dest && is_dest_live(&intrin->dest, defs_live)); + (info->has_dest && is_def_live(&intrin->dest.ssa, defs_live)); } case nir_instr_type_tex: { nir_tex_instr *tex = nir_instr_as_tex(instr); - return is_dest_live(&tex->dest, defs_live); + return is_def_live(&tex->dest.ssa, defs_live); } case nir_instr_type_phi: { nir_phi_instr *phi = nir_instr_as_phi(instr); - return is_dest_live(&phi->dest, defs_live); + return is_def_live(&phi->dest.ssa, defs_live); } case nir_instr_type_load_const: { nir_load_const_instr *lc = nir_instr_as_load_const(instr); - return BITSET_TEST(defs_live, lc->def.index); + return is_def_live(&lc->def, defs_live); } case nir_instr_type_ssa_undef: { nir_undef_instr *undef = nir_instr_as_ssa_undef(instr); - return BITSET_TEST(defs_live, undef->def.index); + return is_def_live(&undef->def, defs_live); } case nir_instr_type_parallel_copy: { nir_parallel_copy_instr *pc = nir_instr_as_parallel_copy(instr); nir_foreach_parallel_copy_entry(entry, pc) { - if (entry->dest_is_reg || is_dest_live(&entry->dest.dest, defs_live)) + if (entry->dest_is_reg || is_def_live(&entry->dest.dest.ssa, defs_live)) return true; } return false; -- 2.7.4