Use more sensible contexts in ir_dead_code_local.
authorKenneth Graunke <kenneth@whitecape.org>
Fri, 25 Jun 2010 20:36:14 +0000 (13:36 -0700)
committerEric Anholt <eric@anholt.net>
Mon, 28 Jun 2010 18:14:47 +0000 (11:14 -0700)
src/glsl/ir_dead_code_local.cpp

index e01877077c9b9b282364359e1d2852169c8d7b04..5e197e194843bf937cd093243a5c41e82fb91750 100644 (file)
@@ -111,9 +111,8 @@ public:
  * of a variable to a variable.
  */
 static bool
-process_assignment(ir_assignment *ir, exec_list *assignments)
+process_assignment(void *ctx, ir_assignment *ir, exec_list *assignments)
 {
-   void *ctx = talloc_parent(ir);
    ir_variable *var = NULL;
    bool progress = false;
    kill_for_derefs_visitor v(assignments);
@@ -186,6 +185,7 @@ dead_code_local_basic_block(ir_instruction *first,
    bool *out_progress = (bool *)data;
    bool progress = false;
 
+   void *ctx = talloc(NULL, void*);
    /* Safe looping, since process_assignment */
    for (ir = first, ir_next = (ir_instruction *)first->next;;
        ir = ir_next, ir_next = (ir_instruction *)ir->next) {
@@ -197,7 +197,7 @@ dead_code_local_basic_block(ir_instruction *first,
       }
 
       if (ir_assign) {
-        progress = process_assignment(ir_assign, &assignments) || progress;
+        progress = process_assignment(ctx, ir_assign, &assignments) || progress;
       } else {
         kill_for_derefs_visitor kill(&assignments);
         ir->accept(&kill);
@@ -207,6 +207,7 @@ dead_code_local_basic_block(ir_instruction *first,
         break;
    }
    *out_progress = progress;
+   talloc_free(ctx);
 }
 
 /**