Mesa (glsl2): Use more sensible contexts in ir_dead_code_local.

Eric Anholt anholt at kemper.freedesktop.org
Mon Jun 28 20:30:12 UTC 2010


Module: Mesa
Branch: glsl2
Commit: a815f7fb83b1117e957c097044f36eae3a6851fb
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a815f7fb83b1117e957c097044f36eae3a6851fb

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Fri Jun 25 13:36:14 2010 -0700

Use more sensible contexts in ir_dead_code_local.

---

 src/glsl/ir_dead_code_local.cpp |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/glsl/ir_dead_code_local.cpp b/src/glsl/ir_dead_code_local.cpp
index e018770..5e197e1 100644
--- a/src/glsl/ir_dead_code_local.cpp
+++ b/src/glsl/ir_dead_code_local.cpp
@@ -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);
 }
 
 /**




More information about the mesa-commit mailing list