glsl: Use saved values instead of recomputing them.
authorMatt Turner <mattst88@gmail.com>
Wed, 16 Oct 2013 23:56:43 +0000 (16:56 -0700)
committerMatt Turner <mattst88@gmail.com>
Tue, 22 Oct 2013 05:53:36 +0000 (22:53 -0700)
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
src/glsl/opt_algebraic.cpp

index 3e5802e1818c5314673dfa308f8e64ddbd05300b..b915f3c429b46c01d5bddc6f253caff305dcd47c 100644 (file)
@@ -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;