Mesa (master): nir: return early when lowering a return at the end of a function
Timothy Arceri
tarceri at kemper.freedesktop.org
Tue Apr 17 04:18:08 UTC 2018
Module: Mesa
Branch: master
Commit: 6e22ad6edc34dc07a08b41a781f1c37ff3c536e7
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=6e22ad6edc34dc07a08b41a781f1c37ff3c536e7
Author: Timothy Arceri <tarceri at itsqueeze.com>
Date: Sun Apr 8 21:47:32 2018 +1000
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 at jlekstrand.net>
---
src/compiler/nir/nir_lower_returns.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/compiler/nir/nir_lower_returns.c b/src/compiler/nir/nir_lower_returns.c
index 423192adb8..3ea69e2520 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 */
More information about the mesa-commit
mailing list