glsl: Use saved values instead of recomputing them.
Reviewed-by: Paul Berry <stereotype441@gmail.com> Reviewed-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user