mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 00:10:10 +01:00
nir: return early when lowering a return at the end of a function
Otherwise we create unused conditional return flags and things get unnecessarily ugly fast when lowering nested functions. Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
This commit is contained in:
parent
d3cafc18fc
commit
6e22ad6edc
1 changed files with 6 additions and 0 deletions
|
|
@ -180,6 +180,12 @@ lower_returns_in_block(nir_block *block, struct lower_returns_state *state)
|
|||
|
||||
nir_instr_remove(&jump->instr);
|
||||
|
||||
/* If this is a return in the last block of the function there is nothing
|
||||
* more to do once its removed.
|
||||
*/
|
||||
if (block == nir_impl_last_block(state->builder.impl))
|
||||
return true;
|
||||
|
||||
nir_builder *b = &state->builder;
|
||||
|
||||
/* Set the return flag */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue