From: Matt Turner Date: Thu, 9 Mar 2017 18:56:20 +0000 (-0800) Subject: nir: Return progress from nir_lower_regs_to_ssa(). X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a934b002221eb9ad8c15cfe5ab2ff39e7432c2c6;p=mesa.git nir: Return progress from nir_lower_regs_to_ssa(). And from nir_lower_regs_to_ssa_impl() as well. Reviewed-by: Jason Ekstrand --- diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index 8bf517c3335..8e1721a92dc 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -2389,8 +2389,8 @@ nir_src *nir_get_io_vertex_index_src(nir_intrinsic_instr *instr); bool nir_is_per_vertex_io(nir_variable *var, gl_shader_stage stage); void nir_lower_io_types(nir_shader *shader); -void nir_lower_regs_to_ssa_impl(nir_function_impl *impl); -void nir_lower_regs_to_ssa(nir_shader *shader); +bool nir_lower_regs_to_ssa_impl(nir_function_impl *impl); +bool nir_lower_regs_to_ssa(nir_shader *shader); bool nir_lower_vars_to_ssa(nir_shader *shader); bool nir_remove_dead_variables(nir_shader *shader, nir_variable_mode modes); diff --git a/src/compiler/nir/nir_lower_regs_to_ssa.c b/src/compiler/nir/nir_lower_regs_to_ssa.c index 095bae66927..d70e70260be 100644 --- a/src/compiler/nir/nir_lower_regs_to_ssa.c +++ b/src/compiler/nir/nir_lower_regs_to_ssa.c @@ -210,11 +210,11 @@ rewrite_alu_instr(nir_alu_instr *alu, struct regs_to_ssa_state *state) &vec->dest.dest.ssa); } -void +bool nir_lower_regs_to_ssa_impl(nir_function_impl *impl) { if (exec_list_is_empty(&impl->registers)) - return; + return false; nir_metadata_require(impl, nir_metadata_block_index | nir_metadata_dominance); @@ -279,15 +279,19 @@ nir_lower_regs_to_ssa_impl(nir_function_impl *impl) nir_metadata_preserve(impl, nir_metadata_block_index | nir_metadata_dominance); + return true; } -void +bool nir_lower_regs_to_ssa(nir_shader *shader) { assert(exec_list_is_empty(&shader->registers)); + bool progress = false; nir_foreach_function(function, shader) { if (function->impl) - nir_lower_regs_to_ssa_impl(function->impl); + progress |= nir_lower_regs_to_ssa_impl(function->impl); } + + return progress; }