intel/compiler: use nir_shader_instructions_pass in brw_nir_lower_conversions
No functional changes. Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com> Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13189>
This commit is contained in:
parent
5b8c993d50
commit
183987d438
|
@ -63,7 +63,7 @@ split_conversion(nir_builder *b, nir_alu_instr *alu, nir_op op1, nir_op op2)
|
|||
}
|
||||
|
||||
static bool
|
||||
lower_instr(nir_builder *b, nir_alu_instr *alu)
|
||||
lower_alu_instr(nir_builder *b, nir_alu_instr *alu)
|
||||
{
|
||||
unsigned src_bit_size = nir_src_bit_size(alu->src[0].src);
|
||||
nir_alu_type src_type = nir_op_infos[alu->op].input_types[0];
|
||||
|
@ -126,46 +126,25 @@ lower_instr(nir_builder *b, nir_alu_instr *alu)
|
|||
}
|
||||
|
||||
static bool
|
||||
lower_impl(nir_function_impl *impl)
|
||||
lower_instr(nir_builder *b, nir_instr *instr, UNUSED void *cb_data)
|
||||
{
|
||||
nir_builder b;
|
||||
nir_builder_init(&b, impl);
|
||||
bool progress = false;
|
||||
if (instr->type != nir_instr_type_alu)
|
||||
return false;
|
||||
|
||||
nir_foreach_block(block, impl) {
|
||||
nir_foreach_instr_safe(instr, block) {
|
||||
if (instr->type != nir_instr_type_alu)
|
||||
continue;
|
||||
nir_alu_instr *alu = nir_instr_as_alu(instr);
|
||||
assert(alu->dest.dest.is_ssa);
|
||||
|
||||
nir_alu_instr *alu = nir_instr_as_alu(instr);
|
||||
assert(alu->dest.dest.is_ssa);
|
||||
if (!nir_op_infos[alu->op].is_conversion)
|
||||
return false;
|
||||
|
||||
if (!nir_op_infos[alu->op].is_conversion)
|
||||
continue;
|
||||
|
||||
progress = lower_instr(&b, alu) || progress;
|
||||
}
|
||||
}
|
||||
|
||||
if (progress) {
|
||||
nir_metadata_preserve(impl, nir_metadata_block_index |
|
||||
nir_metadata_dominance);
|
||||
} else {
|
||||
nir_metadata_preserve(impl, nir_metadata_all);
|
||||
}
|
||||
|
||||
return progress;
|
||||
return lower_alu_instr(b, alu);
|
||||
}
|
||||
|
||||
bool
|
||||
brw_nir_lower_conversions(nir_shader *shader)
|
||||
{
|
||||
bool progress = false;
|
||||
|
||||
nir_foreach_function(function, shader) {
|
||||
if (function->impl)
|
||||
progress |= lower_impl(function->impl);
|
||||
}
|
||||
|
||||
return progress;
|
||||
return nir_shader_instructions_pass(shader, lower_instr,
|
||||
nir_metadata_block_index |
|
||||
nir_metadata_dominance,
|
||||
NULL);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue