aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 */