diff options
-rw-r--r-- | src/glsl/ir_copy_propagation.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/glsl/ir_copy_propagation.cpp b/src/glsl/ir_copy_propagation.cpp index 1d28392d7c3..90a49d5a82a 100644 --- a/src/glsl/ir_copy_propagation.cpp +++ b/src/glsl/ir_copy_propagation.cpp @@ -164,11 +164,17 @@ ir_copy_propagation_visitor::visit(ir_dereference_variable *ir) ir_visitor_status ir_copy_propagation_visitor::visit_enter(ir_call *ir) { - (void)ir; - - /* Note, if we were to do copy propagation to parameters of calls, we'd - * have to be careful about out params. - */ + /* Do copy propagation on call parameters, but skip any out params */ + exec_list_iterator sig_param_iter = ir->get_callee()->parameters.iterator(); + foreach_iter(exec_list_iterator, iter, ir->actual_parameters) { + ir_variable *sig_param = (ir_variable *)sig_param_iter.get(); + ir_instruction *ir = (ir_instruction *)iter.get(); + if (sig_param->mode != ir_var_out && sig_param->mode != ir_var_inout && + sig_param->mode != ir_var_uniform) { + ir->accept(this); + } + sig_param_iter.next(); + } return visit_continue_with_parent; } |