summaryrefslogtreecommitdiffstats
path: root/src/glsl
diff options
context:
space:
mode:
authorAras Pranckevicius <[email protected]>2010-08-06 16:09:02 +0200
committerEric Anholt <[email protected]>2010-08-06 14:13:15 -0700
commit63cddb27d7e0f8d3fd71ccdf719341432a0ca970 (patch)
tree3a60c44334806626abd58470b61d2fb6be0e1daf /src/glsl
parent925b49ff310bf0b307add7c34627cddf87e6a554 (diff)
copy_propagation: do propagation into non-out call params
Diffstat (limited to 'src/glsl')
-rw-r--r--src/glsl/ir_copy_propagation.cpp16
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;
}