From: Marek Olšák <marek.ol...@amd.com> --- src/compiler/glsl/opt_copy_propagation.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/compiler/glsl/opt_copy_propagation.cpp b/src/compiler/glsl/opt_copy_propagation.cpp index 02628cd..247c498 100644 --- a/src/compiler/glsl/opt_copy_propagation.cpp +++ b/src/compiler/glsl/opt_copy_propagation.cpp @@ -37,35 +37,39 @@ #include "ir_basic_block.h" #include "ir_optimization.h" #include "compiler/glsl_types.h" #include "util/hash_table.h" namespace { class kill_entry : public exec_node { public: + /* override operator new from exec_node */ + DECLARE_LINEAR_ZALLOC_CXX_OPERATORS(kill_entry) + kill_entry(ir_variable *var) { assert(var); this->var = var; } ir_variable *var; }; class ir_copy_propagation_visitor : public ir_hierarchical_visitor { public: ir_copy_propagation_visitor() { progress = false; mem_ctx = ralloc_context(0); + lin_ctx = linear_alloc_parent(mem_ctx, 0); acp = _mesa_hash_table_create(mem_ctx, _mesa_hash_pointer, _mesa_key_pointer_equal); this->kills = new(mem_ctx) exec_list; killed_all = false; } ~ir_copy_propagation_visitor() { ralloc_free(mem_ctx); } @@ -88,20 +92,21 @@ public: * List of kill_entry: The variables whose values were killed in this * block. */ exec_list *kills; bool progress; bool killed_all; void *mem_ctx; + void *lin_ctx; }; } /* unnamed namespace */ ir_visitor_status ir_copy_propagation_visitor::visit_enter(ir_function_signature *ir) { /* Treat entry into a function signature as a completely separate * block. Any instructions at global scope will be shuffled into * main() at link time, so they're irrelevant to us. @@ -306,21 +311,21 @@ ir_copy_propagation_visitor::kill(ir_variable *var) } hash_table_foreach(acp, entry) { if (var == (ir_variable *) entry->data) { _mesa_hash_table_remove(acp, entry); } } /* Add the LHS variable to the list of killed variables in this block. */ - this->kills->push_tail(new(this->kills) kill_entry(var)); + this->kills->push_tail(new(this->lin_ctx) kill_entry(var)); } /** * Adds an entry to the available copy list if it's a plain assignment * of a variable to a variable. */ void ir_copy_propagation_visitor::add_copy(ir_assignment *ir) { if (ir->condition) -- 2.7.4 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev