nir/nir_opt_copy_prop_vars: reorder clone calls

This helps with the reuse of dynamic arrays.

Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20381>
This commit is contained in:
Timothy Arceri 2022-12-18 12:36:15 +11:00 committed by Marge Bot
parent 2a2d85e254
commit d1a41d9c64

View file

@ -1446,26 +1446,27 @@ copy_prop_vars_cf_node(struct copy_prop_var_state *state,
* interfere to each other.
*/
struct copies *then_copies = get_copies_structure(state);
struct copies *else_copies = get_copies_structure(state);
clone_copies(state, then_copies, copies);
clone_copies(state, else_copies, copies);
foreach_list_typed_safe(nir_cf_node, cf_node, node, &if_stmt->then_list)
copy_prop_vars_cf_node(state, then_copies, cf_node);
clear_copies_structure(state, then_copies);
struct copies *else_copies = get_copies_structure(state);
clone_copies(state, else_copies, copies);
foreach_list_typed_safe(nir_cf_node, cf_node, node, &if_stmt->else_list)
copy_prop_vars_cf_node(state, else_copies, cf_node);
clear_copies_structure(state, else_copies);
/* Both branches copies can be ignored, since the effect of running both
* branches was captured in the first pass that collects vars_written.
*/
invalidate_copies_for_cf_node(state, copies, cf_node);
clear_copies_structure(state, then_copies);
clear_copies_structure(state, else_copies);
break;
}