Module: Mesa Branch: staging/20.0 Commit: 5bbf4cc54e688805f77848bcdc118ddc80693916 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=5bbf4cc54e688805f77848bcdc118ddc80693916
Author: Arcady Goldmints-Orlov <[email protected]> Date: Thu Apr 16 16:28:12 2020 -0500 nir: Lower returns correctly inside nested loops Inside nested flow control, nir_lower_returns inserts predicated breaks in the outer block. However, it would omit doing this if the remainder of the outer block (after the inner block) was empty. This is not correct in the case of loops, as execution just wraps back around to the start of the loop, so this change doesn't skip the predication inside loops. Fixes: 79dec93ead6e (nir: Add return lowering pass) Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/2724 Reviewed-by: Jason Ekstrand <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4603> (cherry picked from commit ec1b96fdc8bccaf2c1a4e1e3cca32b4aacbe4f7c) --- .pick_status.json | 2 +- src/compiler/nir/nir_lower_returns.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 839d00f452c..4f3fd2dc2b9 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -193,7 +193,7 @@ "description": "nir: Lower returns correctly inside nested loops", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "master_sha": null, "because_sha": "79dec93ead6e3b95b1240a9d843d617a88ee9179" }, diff --git a/src/compiler/nir/nir_lower_returns.c b/src/compiler/nir/nir_lower_returns.c index e166a7cc32a..ecbbf43da3b 100644 --- a/src/compiler/nir/nir_lower_returns.c +++ b/src/compiler/nir/nir_lower_returns.c @@ -50,7 +50,7 @@ predicate_following(nir_cf_node *node, struct lower_returns_state *state) nir_builder *b = &state->builder; b->cursor = nir_after_cf_node_and_phis(node); - if (nir_cursors_equal(b->cursor, nir_after_cf_list(state->cf_list))) + if (!state->loop && nir_cursors_equal(b->cursor, nir_after_cf_list(state->cf_list))) return; /* Nothing to predicate */ assert(state->return_flag); _______________________________________________ mesa-commit mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-commit
