nir: Use nir_foreach_phi(_safe)
The pattern shows up all the time open-coded. Use the macro instead. Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com> Reviewed-by: Jesse Natalie <jenatali@microsoft.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22967>
This commit is contained in:
committed by
Marge Bot
parent
7dc297cc14
commit
aa6bdbd54a
@@ -68,12 +68,7 @@ remove_phis_block(nir_block *block, nir_builder *b)
|
||||
{
|
||||
bool progress = false;
|
||||
|
||||
nir_foreach_instr_safe(instr, block) {
|
||||
if (instr->type != nir_instr_type_phi)
|
||||
break;
|
||||
|
||||
nir_phi_instr *phi = nir_instr_as_phi(instr);
|
||||
|
||||
nir_foreach_phi_safe(phi, block) {
|
||||
nir_ssa_def *def = NULL;
|
||||
nir_alu_instr *mov = NULL;
|
||||
bool srcs_same = true;
|
||||
@@ -133,7 +128,7 @@ remove_phis_block(nir_block *block, nir_builder *b)
|
||||
|
||||
assert(phi->dest.is_ssa);
|
||||
nir_ssa_def_rewrite_uses(&phi->dest.ssa, def);
|
||||
nir_instr_remove(instr);
|
||||
nir_instr_remove(&phi->instr);
|
||||
|
||||
progress = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user