nir/split_var_copies: Use a nir_shader rather than a void *mem_ctx
authorJason Ekstrand <jason.ekstrand@intel.com>
Sat, 24 Dec 2016 19:03:01 +0000 (11:03 -0800)
committerJason Ekstrand <jason.ekstrand@intel.com>
Fri, 30 Dec 2016 20:38:04 +0000 (12:38 -0800)
Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
src/compiler/nir/nir_split_var_copies.c

index cfebb0bb94826127d6c993f0fffd4657db005bb1..94a45ee26a6a0f389548fe372fa982aaf6327ae6 100644 (file)
@@ -62,7 +62,7 @@
  */
 
 struct split_var_copies_state {
-   void *mem_ctx;
+   nir_shader *shader;
    void *dead_ctx;
    bool progress;
 };
@@ -176,7 +176,7 @@ split_var_copy_instr(nir_intrinsic_instr *old_copy,
           * actually add the new copy instruction.
           */
          nir_intrinsic_instr *new_copy =
-            nir_intrinsic_instr_create(state->mem_ctx, nir_intrinsic_copy_var);
+            nir_intrinsic_instr_create(state->shader, nir_intrinsic_copy_var);
 
          /* We need to make copies because a) this deref chain actually
           * belongs to the copy instruction and b) the deref chains may
@@ -254,7 +254,7 @@ split_var_copies_impl(nir_function_impl *impl)
 {
    struct split_var_copies_state state;
 
-   state.mem_ctx = ralloc_parent(impl);
+   state.shader = impl->function->shader;
    state.dead_ctx = ralloc_context(NULL);
    state.progress = false;