glsl2: Fix the linked version of ir_dead_code.
authorEric Anholt <eric@anholt.net>
Tue, 27 Jul 2010 18:29:17 +0000 (11:29 -0700)
committerEric Anholt <eric@anholt.net>
Tue, 27 Jul 2010 18:46:06 +0000 (11:46 -0700)
If we don't walk into functions, we won't see any usage of variables
in the functions.

src/glsl/ir_dead_code.cpp

index 4804407bdc32eeb3a423ae2310c6bfed88f655b3..eab459b920fe3a2f1e39c99dac5ff0eabca1c0f3 100644 (file)
@@ -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;
 }