nir: Return progress from nir_move_vec_src_uses_to_dest().
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
This commit is contained in:
@@ -2397,7 +2397,7 @@ bool nir_remove_dead_variables(nir_shader *shader, nir_variable_mode modes);
|
|||||||
bool nir_lower_constant_initializers(nir_shader *shader,
|
bool nir_lower_constant_initializers(nir_shader *shader,
|
||||||
nir_variable_mode modes);
|
nir_variable_mode modes);
|
||||||
|
|
||||||
void nir_move_vec_src_uses_to_dest(nir_shader *shader);
|
bool nir_move_vec_src_uses_to_dest(nir_shader *shader);
|
||||||
bool nir_lower_vec_to_movs(nir_shader *shader);
|
bool nir_lower_vec_to_movs(nir_shader *shader);
|
||||||
bool nir_lower_alu_to_scalar(nir_shader *shader);
|
bool nir_lower_alu_to_scalar(nir_shader *shader);
|
||||||
bool nir_lower_load_const_to_scalar(nir_shader *shader);
|
bool nir_lower_load_const_to_scalar(nir_shader *shader);
|
||||||
|
@@ -64,6 +64,8 @@ ssa_def_dominates_instr(nir_ssa_def *def, nir_instr *instr)
|
|||||||
static bool
|
static bool
|
||||||
move_vec_src_uses_to_dest_block(nir_block *block)
|
move_vec_src_uses_to_dest_block(nir_block *block)
|
||||||
{
|
{
|
||||||
|
bool progress = false;
|
||||||
|
|
||||||
nir_foreach_instr(instr, block) {
|
nir_foreach_instr(instr, block) {
|
||||||
if (instr->type != nir_instr_type_alu)
|
if (instr->type != nir_instr_type_alu)
|
||||||
continue;
|
continue;
|
||||||
@@ -167,34 +169,44 @@ move_vec_src_uses_to_dest_block(nir_block *block)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
use_alu_src->swizzle[j] = swizzle[use_alu_src->swizzle[j]];
|
use_alu_src->swizzle[j] = swizzle[use_alu_src->swizzle[j]];
|
||||||
|
progress = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return progress;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static bool
|
||||||
nir_move_vec_src_uses_to_dest_impl(nir_shader *shader, nir_function_impl *impl)
|
nir_move_vec_src_uses_to_dest_impl(nir_shader *shader, nir_function_impl *impl)
|
||||||
{
|
{
|
||||||
|
bool progress = false;
|
||||||
|
|
||||||
nir_metadata_require(impl, nir_metadata_dominance);
|
nir_metadata_require(impl, nir_metadata_dominance);
|
||||||
|
|
||||||
nir_index_instrs(impl);
|
nir_index_instrs(impl);
|
||||||
|
|
||||||
nir_foreach_block(block, impl) {
|
nir_foreach_block(block, impl) {
|
||||||
move_vec_src_uses_to_dest_block(block);
|
progress |= move_vec_src_uses_to_dest_block(block);
|
||||||
}
|
}
|
||||||
|
|
||||||
nir_metadata_preserve(impl, nir_metadata_block_index |
|
nir_metadata_preserve(impl, nir_metadata_block_index |
|
||||||
nir_metadata_dominance);
|
nir_metadata_dominance);
|
||||||
|
|
||||||
|
return progress;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
bool
|
||||||
nir_move_vec_src_uses_to_dest(nir_shader *shader)
|
nir_move_vec_src_uses_to_dest(nir_shader *shader)
|
||||||
{
|
{
|
||||||
|
bool progress = false;
|
||||||
|
|
||||||
nir_foreach_function(function, shader) {
|
nir_foreach_function(function, shader) {
|
||||||
if (function->impl)
|
if (function->impl)
|
||||||
nir_move_vec_src_uses_to_dest_impl(shader, function->impl);
|
progress |= nir_move_vec_src_uses_to_dest_impl(shader,
|
||||||
|
function->impl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return progress;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user