X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fcompiler%2Fnir%2Fnir_sweep.c;h=e2b70f5f76710bc627fbf34e9eacfa0ce5bc6ce4;hb=43d22c8f2011b780467df97e58981522edccfa21;hp=b22f0f5656937fec6bd057776fd1c5e347f70608;hpb=2c3f95d6aaab38cd66dd3dee1b089d5c91928eea;p=mesa.git diff --git a/src/compiler/nir/nir_sweep.c b/src/compiler/nir/nir_sweep.c index b22f0f56569..e2b70f5f767 100644 --- a/src/compiler/nir/nir_sweep.c +++ b/src/compiler/nir/nir_sweep.c @@ -63,7 +63,16 @@ sweep_block(nir_shader *nir, nir_block *block) { ralloc_steal(nir, block); - nir_foreach_instr(block, instr) { + /* sweep_impl will mark all metadata invalid. We can safely release all of + * this here. + */ + ralloc_free(block->live_in); + block->live_in = NULL; + + ralloc_free(block->live_out); + block->live_out = NULL; + + nir_foreach_instr(instr, block) { ralloc_steal(nir, instr); nir_foreach_src(instr, sweep_src_indirect, nir); @@ -118,10 +127,6 @@ sweep_impl(nir_shader *nir, nir_function_impl *impl) { ralloc_steal(nir, impl); - ralloc_steal(nir, impl->params); - for (unsigned i = 0; i < impl->num_params; i++) - ralloc_steal(nir, impl->params[i]); - ralloc_steal(nir, impl->return_var); steal_list(nir, nir_variable, &impl->locals); steal_list(nir, nir_register, &impl->registers); @@ -158,19 +163,15 @@ nir_sweep(nir_shader *nir) ralloc_steal(nir, (char *)nir->info.label); /* Variables and registers are not dead. Steal them back. */ - steal_list(nir, nir_variable, &nir->uniforms); - steal_list(nir, nir_variable, &nir->inputs); - steal_list(nir, nir_variable, &nir->outputs); - steal_list(nir, nir_variable, &nir->shared); - steal_list(nir, nir_variable, &nir->globals); - steal_list(nir, nir_variable, &nir->system_values); - steal_list(nir, nir_register, &nir->registers); + steal_list(nir, nir_variable, &nir->variables); /* Recurse into functions, stealing their contents back. */ foreach_list_typed(nir_function, func, node, &nir->functions) { sweep_function(nir, func); } + ralloc_steal(nir, nir->constant_data); + /* Free everything we didn't steal back. */ ralloc_free(rubbish); }