From: Timothy Arceri Date: Sun, 8 Apr 2018 11:47:32 +0000 (+1000) Subject: nir: return early when lowering a return at the end of a function X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6e22ad6edc34dc07a08b41a781f1c37ff3c536e7;p=mesa.git 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 --- diff --git a/src/compiler/nir/nir_lower_returns.c b/src/compiler/nir/nir_lower_returns.c index 423192adb8a..3ea69e25204 100644 --- a/src/compiler/nir/nir_lower_returns.c +++ b/src/compiler/nir/nir_lower_returns.c @@ -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 */