summaryrefslogtreecommitdiffstats
path: root/src/compiler/nir
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2018-04-08 21:47:32 +1000
committerTimothy Arceri <[email protected]>2018-04-17 14:17:56 +1000
commit6e22ad6edc34dc07a08b41a781f1c37ff3c536e7 (patch)
tree99e715991b57c134958afa9e737af5ab6f3b0ea3 /src/compiler/nir
parentd3cafc18fced872ce60060e792f6faf2b97cc3a9 (diff)
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 <[email protected]>
Diffstat (limited to 'src/compiler/nir')
-rw-r--r--src/compiler/nir/nir_lower_returns.c6
1 files changed, 6 insertions, 0 deletions
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 */