From: Eric Anholt Date: Tue, 27 Jul 2010 18:29:17 +0000 (-0700) Subject: glsl2: Fix the linked version of ir_dead_code. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5532c4ca696fea32fb9b2f8de15beabe4a20ae15;p=mesa.git glsl2: Fix the linked version of ir_dead_code. If we don't walk into functions, we won't see any usage of variables in the functions. --- diff --git a/src/glsl/ir_dead_code.cpp b/src/glsl/ir_dead_code.cpp index 4804407bdc3..eab459b920f 100644 --- a/src/glsl/ir_dead_code.cpp +++ b/src/glsl/ir_dead_code.cpp @@ -61,7 +61,7 @@ public: virtual ir_visitor_status visit(ir_variable *); virtual ir_visitor_status visit(ir_dereference_variable *); - virtual ir_visitor_status visit_enter(ir_function *); + virtual ir_visitor_status visit_enter(ir_function_signature *); virtual ir_visitor_status visit_leave(ir_assignment *); variable_entry *get_variable_entry(ir_variable *var); @@ -116,9 +116,12 @@ ir_dead_code_visitor::visit(ir_dereference_variable *ir) ir_visitor_status -ir_dead_code_visitor::visit_enter(ir_function *ir) +ir_dead_code_visitor::visit_enter(ir_function_signature *ir) { - (void) ir; + /* We don't want to descend into the function parameters and + * dead-code eliminate them, so just accept the body here. + */ + visit_list_elements(this, &ir->body); return visit_continue_with_parent; }