From 63cddb27d7e0f8d3fd71ccdf719341432a0ca970 Mon Sep 17 00:00:00 2001 From: Aras Pranckevicius Date: Fri, 6 Aug 2010 16:09:02 +0200 Subject: [PATCH] copy_propagation: do propagation into non-out call params --- src/glsl/ir_copy_propagation.cpp | 16 +++++++++++----- 1 file 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; } -- 2.30.2