nir: use nir_shader_instructions_pass in nir_lower_64bit_phis
No functional changes. Reviewed-by: Alyssa Rosenzweig <alyssa@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12282>
This commit is contained in:

committed by
Marge Bot

parent
ea39efe9b8
commit
c7078fe4e0
@@ -329,47 +329,26 @@ split_phi(nir_builder *b, nir_phi_instr *phi)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
lower_64bit_phi_impl(nir_function_impl *impl)
|
lower_64bit_phi_instr(nir_builder *b, nir_instr *instr, UNUSED void *cb_data)
|
||||||
{
|
{
|
||||||
nir_builder b;
|
if (instr->type != nir_instr_type_phi)
|
||||||
nir_builder_init(&b, impl);
|
return false;
|
||||||
bool progress = false;
|
|
||||||
|
|
||||||
nir_foreach_block(block, impl) {
|
nir_phi_instr *phi = nir_instr_as_phi(instr);
|
||||||
nir_foreach_instr_safe(instr, block) {
|
assert(phi->dest.is_ssa);
|
||||||
if (instr->type != nir_instr_type_phi)
|
|
||||||
break;
|
|
||||||
|
|
||||||
nir_phi_instr *phi = nir_instr_as_phi(instr);
|
if (phi->dest.ssa.bit_size <= 32)
|
||||||
assert(phi->dest.is_ssa);
|
return false;
|
||||||
|
|
||||||
if (phi->dest.ssa.bit_size <= 32)
|
split_phi(b, phi);
|
||||||
continue;
|
return true;
|
||||||
|
|
||||||
split_phi(&b, phi);
|
|
||||||
progress = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (progress) {
|
|
||||||
nir_metadata_preserve(impl, nir_metadata_block_index |
|
|
||||||
nir_metadata_dominance);
|
|
||||||
} else {
|
|
||||||
nir_metadata_preserve(impl, nir_metadata_all);
|
|
||||||
}
|
|
||||||
|
|
||||||
return progress;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
nir_lower_64bit_phis(nir_shader *shader)
|
nir_lower_64bit_phis(nir_shader *shader)
|
||||||
{
|
{
|
||||||
bool progress = false;
|
return nir_shader_instructions_pass(shader, lower_64bit_phi_instr,
|
||||||
|
nir_metadata_block_index |
|
||||||
nir_foreach_function(function, shader) {
|
nir_metadata_dominance,
|
||||||
if (function->impl)
|
NULL);
|
||||||
progress |= lower_64bit_phi_impl(function->impl);
|
|
||||||
}
|
|
||||||
|
|
||||||
return progress;
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user