Mesa (master): nir/find_array_copies: Don't assume all children exist
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Nov 4 06:11:14 UTC 2020
Module: Mesa
Branch: master
Commit: 58e7088628a362fe9d3163429a12e5f828b5b200
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=58e7088628a362fe9d3163429a12e5f828b5b200
Author: Jason Ekstrand <jason at jlekstrand.net>
Date: Tue Nov 3 22:46:14 2020 -0600
nir/find_array_copies: Don't assume all children exist
Fixes: 9f3c595dfc4cd "nir/find_array_copies: Handle cast derefs"
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7437>
---
src/compiler/nir/nir_opt_find_array_copies.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/compiler/nir/nir_opt_find_array_copies.c b/src/compiler/nir/nir_opt_find_array_copies.c
index 5c0fede765b..86ab25b9560 100644
--- a/src/compiler/nir/nir_opt_find_array_copies.c
+++ b/src/compiler/nir/nir_opt_find_array_copies.c
@@ -196,8 +196,10 @@ _foreach_child(match_cb cb, struct match_node *node, struct match_state *state)
if (node->num_children == 0) {
cb(node, state);
} else {
- for (unsigned i = 0; i < node->num_children; i++)
- _foreach_child(cb, node->children[i], state);
+ for (unsigned i = 0; i < node->num_children; i++) {
+ if (node->children[i])
+ _foreach_child(cb, node->children[i], state);
+ }
}
}
More information about the mesa-commit
mailing list