Mesa (glsl2): Use a more sensible context in copy propagation.

Eric Anholt anholt at kemper.freedesktop.org
Mon Jun 28 13:30:13 PDT 2010


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

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

Use a more sensible context in copy propagation.

---

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

diff --git a/src/glsl/ir_copy_propagation.cpp b/src/glsl/ir_copy_propagation.cpp
index 46ef667..a02852e 100644
--- a/src/glsl/ir_copy_propagation.cpp
+++ b/src/glsl/ir_copy_propagation.cpp
@@ -195,9 +195,8 @@ kill_invalidated_copies(ir_assignment *ir, exec_list *acp)
  * of a variable to a variable.
  */
 static void
-add_copy(ir_assignment *ir, exec_list *acp)
+add_copy(void *ctx, ir_assignment *ir, exec_list *acp)
 {
-   void *ctx = talloc_parent(ir);
    acp_entry *entry;
 
    if (ir->condition) {
@@ -226,6 +225,7 @@ copy_propagation_basic_block(ir_instruction *first,
    bool *out_progress = (bool *)data;
    bool progress = false;
 
+   void *ctx = talloc(NULL, void*);
    for (ir = first;; ir = (ir_instruction *)ir->next) {
       ir_assignment *ir_assign = ir->as_assignment();
 
@@ -234,12 +234,13 @@ copy_propagation_basic_block(ir_instruction *first,
       if (ir_assign) {
 	 kill_invalidated_copies(ir_assign, &acp);
 
-	 add_copy(ir_assign, &acp);
+	 add_copy(ctx, ir_assign, &acp);
       }
       if (ir == last)
 	 break;
    }
    *out_progress = progress;
+   talloc_free(ctx);
 }
 
 /**



More information about the mesa-commit mailing list