From 295faf9462cba88250d8581f65611996eba5e389 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Fri, 12 Dec 2014 16:25:38 -0800 Subject: nir: Call nir_metadata_preserve more places Reviewed-by: Connor Abbott --- src/glsl/nir/nir_from_ssa.c | 3 +++ src/glsl/nir/nir_lower_atomics.c | 5 ++++- src/glsl/nir/nir_lower_io.c | 3 +++ src/glsl/nir/nir_lower_locals_to_regs.c | 3 +++ src/glsl/nir/nir_lower_system_values.c | 2 ++ src/glsl/nir/nir_opt_constant_folding.c | 4 ++++ src/glsl/nir/nir_opt_dce.c | 4 ++++ src/glsl/nir/nir_to_ssa.c | 5 ++++- 8 files changed, 27 insertions(+), 2 deletions(-) (limited to 'src/glsl/nir') 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); } -- cgit v1.2.3