diff options
-rw-r--r-- | src/compiler/nir/nir_opt_find_array_copies.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/compiler/nir/nir_opt_find_array_copies.c b/src/compiler/nir/nir_opt_find_array_copies.c index 0e50ca18af9..83f284ecbfc 100644 --- a/src/compiler/nir/nir_opt_find_array_copies.c +++ b/src/compiler/nir/nir_opt_find_array_copies.c @@ -191,6 +191,17 @@ node_for_path_with_wildcard(nir_deref_path *path, unsigned wildcard_idx, typedef void (*match_cb)(struct match_node *, struct match_state *); static void +_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); + } +} + +static void _foreach_aliasing(nir_deref_instr **deref, match_cb cb, struct match_node *node, struct match_state *state) { @@ -233,22 +244,15 @@ _foreach_aliasing(nir_deref_instr **deref, match_cb cb, return; } + case nir_deref_type_cast: + _foreach_child(cb, node, state); + return; + default: unreachable("bad deref type"); } } -static void -_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); - } -} - /* Given a deref path, find all the leaf deref nodes that alias it. */ static void |