From: Jason Ekstrand Date: Sat, 13 Dec 2014 00:25:38 +0000 (-0800) Subject: nir: Call nir_metadata_preserve more places X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=295faf9462cba88250d8581f65611996eba5e389;p=mesa.git nir: Call nir_metadata_preserve more places Reviewed-by: Connor Abbott --- diff --git a/src/glsl/nir/nir_from_ssa.c b/src/glsl/nir/nir_from_ssa.c index f99ba9b7828..d3295804b5a 100644 --- a/src/glsl/nir/nir_from_ssa.c +++ b/src/glsl/nir/nir_from_ssa.c @@ -843,6 +843,9 @@ nir_convert_from_ssa_impl(nir_function_impl *impl) nir_foreach_block(impl, resolve_parallel_copies_block, &state); + nir_metadata_preserve(impl, nir_metadata_block_index | + nir_metadata_dominance); + /* Clean up dead instructions and the hash tables */ _mesa_hash_table_destroy(state.ssa_table, NULL); _mesa_hash_table_destroy(state.merge_node_table, NULL); diff --git a/src/glsl/nir/nir_lower_atomics.c b/src/glsl/nir/nir_lower_atomics.c index 23d5de0c0ac..b43e4fedf0d 100644 --- a/src/glsl/nir/nir_lower_atomics.c +++ b/src/glsl/nir/nir_lower_atomics.c @@ -137,7 +137,10 @@ void nir_lower_atomics(nir_shader *shader) { nir_foreach_overload(shader, overload) { - if (overload->impl) + if (overload->impl) { nir_foreach_block(overload->impl, lower_block, overload->impl); + nir_metadata_preserve(overload->impl, nir_metadata_block_index | + nir_metadata_dominance); + } } } diff --git a/src/glsl/nir/nir_lower_io.c b/src/glsl/nir/nir_lower_io.c index 9fc11b3ca8c..91ad561fda5 100644 --- a/src/glsl/nir/nir_lower_io.c +++ b/src/glsl/nir/nir_lower_io.c @@ -310,6 +310,9 @@ nir_lower_io_impl(nir_function_impl *impl) state.mem_ctx = ralloc_parent(impl); nir_foreach_block(impl, nir_lower_io_block, &state); + + nir_metadata_preserve(impl, nir_metadata_block_index | + nir_metadata_dominance); } void diff --git a/src/glsl/nir/nir_lower_locals_to_regs.c b/src/glsl/nir/nir_lower_locals_to_regs.c index e2a8fa74e10..f0238b09dab 100644 --- a/src/glsl/nir/nir_lower_locals_to_regs.c +++ b/src/glsl/nir/nir_lower_locals_to_regs.c @@ -292,6 +292,9 @@ nir_lower_locals_to_regs_impl(nir_function_impl *impl) nir_foreach_block(impl, lower_locals_to_regs_block, &state); + nir_metadata_preserve(impl, nir_metadata_block_index | + nir_metadata_dominance); + _mesa_hash_table_destroy(state.regs_table, NULL); } diff --git a/src/glsl/nir/nir_lower_system_values.c b/src/glsl/nir/nir_lower_system_values.c index e700df43bb4..7bb02a77bd9 100644 --- a/src/glsl/nir/nir_lower_system_values.c +++ b/src/glsl/nir/nir_lower_system_values.c @@ -91,6 +91,8 @@ static void convert_impl(nir_function_impl *impl) { nir_foreach_block(impl, convert_block, NULL); + nir_metadata_preserve(impl, nir_metadata_block_index | + nir_metadata_dominance); } void diff --git a/src/glsl/nir/nir_opt_constant_folding.c b/src/glsl/nir/nir_opt_constant_folding.c index 6ffa694a34f..3160a3fffb3 100644 --- a/src/glsl/nir/nir_opt_constant_folding.c +++ b/src/glsl/nir/nir_opt_constant_folding.c @@ -330,6 +330,10 @@ nir_opt_constant_folding_impl(nir_function_impl *impl) nir_foreach_block(impl, constant_fold_block, &state); + if (state.progress) + nir_metadata_preserve(impl, nir_metadata_block_index | + nir_metadata_dominance); + return state.progress; } diff --git a/src/glsl/nir/nir_opt_dce.c b/src/glsl/nir/nir_opt_dce.c index 365a8cd75df..8a7490dc3e0 100644 --- a/src/glsl/nir/nir_opt_dce.c +++ b/src/glsl/nir/nir_opt_dce.c @@ -166,6 +166,10 @@ nir_opt_dce_impl(nir_function_impl *impl) bool progress = false; nir_foreach_block(impl, delete_block_cb, &progress); + if (progress) + nir_metadata_preserve(impl, nir_metadata_block_index | + nir_metadata_dominance); + return progress; } diff --git a/src/glsl/nir/nir_to_ssa.c b/src/glsl/nir/nir_to_ssa.c index e73a6eef611..7fdae493887 100644 --- a/src/glsl/nir/nir_to_ssa.c +++ b/src/glsl/nir/nir_to_ssa.c @@ -630,7 +630,7 @@ destroy_rewrite_state(rewrite_state *state) void nir_convert_to_ssa_impl(nir_function_impl *impl) { - nir_calc_dominance_impl(impl); + nir_metadata_require(impl, nir_metadata_dominance); insert_phi_nodes(impl); @@ -641,6 +641,9 @@ nir_convert_to_ssa_impl(nir_function_impl *impl) remove_unused_regs(impl, &state); + nir_metadata_preserve(impl, nir_metadata_block_index | + nir_metadata_dominance); + destroy_rewrite_state(&state); }