nir: Call nir_metadata_preserve more places
authorJason Ekstrand <jason.ekstrand@intel.com>
Sat, 13 Dec 2014 00:25:38 +0000 (16:25 -0800)
committerJason Ekstrand <jason.ekstrand@intel.com>
Thu, 15 Jan 2015 15:20:21 +0000 (07:20 -0800)
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
src/glsl/nir/nir_from_ssa.c
src/glsl/nir/nir_lower_atomics.c
src/glsl/nir/nir_lower_io.c
src/glsl/nir/nir_lower_locals_to_regs.c
src/glsl/nir/nir_lower_system_values.c
src/glsl/nir/nir_opt_constant_folding.c
src/glsl/nir/nir_opt_dce.c
src/glsl/nir/nir_to_ssa.c

index f99ba9b7828bb07a536dcda3f225519e26c79ab1..d3295804b5a6e792c039e0fbc7449028aa682a9c 100644 (file)
@@ -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);
index 23d5de0c0ac34f8d7aee4d2cd3e8d66960ff9661..b43e4fedf0d46c94921d3d00934dd3f7a22a254f 100644 (file)
@@ -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);
+      }
    }
 }
index 9fc11b3ca8c466e8cb67a8a3b0145cf17c9167b4..91ad561fda5effb9e5fe02e6336e308e5c559254 100644 (file)
@@ -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
index e2a8fa74e109b3d4ad8713c734f63f71a2791e78..f0238b09dab086461910fe3f593569d0e5ac9ca5 100644 (file)
@@ -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);
 }
 
index e700df43bb48430b6ba27e9dc116cd0863e4d4c5..7bb02a77bd953e4506333e000fb4a8436b317760 100644 (file)
@@ -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
index 6ffa694a34ff9315d05d74558a1d2709b4c2e8a2..3160a3fffb3e841e611383da0fd6ec8e2af87983 100644 (file)
@@ -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;
 }
 
index 365a8cd75df02d6bbaf16ca1e12aa0b9ef32c769..8a7490dc3e08ee19edff0299c7fdcebd02316d7e 100644 (file)
@@ -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;
 }
 
index e73a6eef61126e90ee64760be37a938dd2cf4ed3..7fdae4938872e09d5f843beee3b82db88b785bad 100644 (file)
@@ -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);
 }