Mesa (master): nir/lower_goto_if: Add a block_for_singular_set helper
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Aug 14 20:55:37 UTC 2020
Module: Mesa
Branch: master
Commit: b892d473b4e9399697d45a98d6cf02fa0e900e7f
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=b892d473b4e9399697d45a98d6cf02fa0e900e7f
Author: Jason Ekstrand <jason at jlekstrand.net>
Date: Wed Aug 12 17:10:49 2020 -0500
nir/lower_goto_if: Add a block_for_singular_set helper
Reviewed-by: Karol Herbst <kherbst at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/2401>
---
src/compiler/nir/nir_lower_goto_ifs.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/compiler/nir/nir_lower_goto_ifs.c b/src/compiler/nir/nir_lower_goto_ifs.c
index 2d7e4946c88..dc6be58268b 100644
--- a/src/compiler/nir/nir_lower_goto_ifs.c
+++ b/src/compiler/nir/nir_lower_goto_ifs.c
@@ -105,6 +105,13 @@ sorted_block_arr_for_set(const struct set *block_set, void *mem_ctx)
return block_arr;
}
+static nir_block *
+block_for_singular_set(const struct set *block_set)
+{
+ assert(block_set->entries == 1);
+ return (nir_block *)_mesa_set_next_entry(block_set, NULL)->key;
+}
+
/**
* Sets all path variables to reach the target block via a fork
*/
@@ -734,9 +741,8 @@ select_blocks(struct routes *routing, nir_builder *b,
struct path in_path, void *mem_ctx)
{
if (!in_path.fork) {
- nir_structurize(routing, b, (nir_block *)
- _mesa_set_next_entry(in_path.reachable, NULL)->key,
- mem_ctx);
+ nir_block *block = block_for_singular_set(in_path.reachable);
+ nir_structurize(routing, b, block, mem_ctx);
} else {
assert(!(in_path.fork->is_var &&
strcmp(in_path.fork->path_var->name, "path_select")));
More information about the mesa-commit
mailing list