summaryrefslogtreecommitdiff
path: root/src/glsl
diff options
context:
space:
mode:
authorMatt Turner <mattst88@gmail.com>2013-10-16 16:56:43 -0700
committerMatt Turner <mattst88@gmail.com>2013-10-21 22:53:36 -0700
commit5b3aec412e1bcbc19b492a2ddd0ce0322acea5f6 (patch)
tree58f339257ec8ad002f9016a330886c87ad5f1945 /src/glsl
parent6aeb7514c3cda04ad75d5192cfd98810aed37193 (diff)
glsl: Use saved values instead of recomputing them.
Reviewed-by: Paul Berry <stereotype441@gmail.com> Reviewed-by: Eric Anholt <eric@anholt.net>
Diffstat (limited to 'src/glsl')
-rw-r--r--src/glsl/opt_algebraic.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp
index 3e5802e1818..b915f3c429b 100644
--- a/src/glsl/opt_algebraic.cpp
+++ b/src/glsl/opt_algebraic.cpp
@@ -257,11 +257,9 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir)
* folding.
*/
if (op_const[0] && !op_const[1])
- reassociate_constant(ir, 0, op_const[0],
- ir->operands[1]->as_expression());
+ reassociate_constant(ir, 0, op_const[0], op_expr[1]);
if (op_const[1] && !op_const[0])
- reassociate_constant(ir, 1, op_const[1],
- ir->operands[0]->as_expression());
+ reassociate_constant(ir, 1, op_const[1], op_expr[0]);
break;
case ir_binop_sub:
@@ -315,11 +313,9 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir)
* constant folding.
*/
if (op_const[0] && !op_const[1])
- reassociate_constant(ir, 0, op_const[0],
- ir->operands[1]->as_expression());
+ reassociate_constant(ir, 0, op_const[0], op_expr[1]);
if (op_const[1] && !op_const[0])
- reassociate_constant(ir, 1, op_const[1],
- ir->operands[0]->as_expression());
+ reassociate_constant(ir, 1, op_const[1], op_expr[0]);
break;