mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-25 17:20:10 +01:00
glsl: Apply the transformation "(a || a) -> a" in opt_algebraic.
total instructions in shared programs: 1732385 -> 1732373 (-0.00%) instructions in affected programs: 416 -> 404 (-2.88%) GAINED: 0 LOST: 0 (That's 4 already-short fragment shaders in dota2) Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
This commit is contained in:
parent
8957c6b887
commit
ee27048262
1 changed files with 3 additions and 1 deletions
|
|
@ -388,7 +388,6 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir)
|
|||
break;
|
||||
|
||||
case ir_binop_logic_or:
|
||||
/* FINISHME: Also simplify (a || a) to (a). */
|
||||
if (is_vec_zero(op_const[0])) {
|
||||
return ir->operands[1];
|
||||
} else if (is_vec_zero(op_const[1])) {
|
||||
|
|
@ -407,6 +406,9 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir)
|
|||
*/
|
||||
return logic_not(logic_and(op_expr[0]->operands[0],
|
||||
op_expr[1]->operands[0]));
|
||||
} else if (ir->operands[0]->equals(ir->operands[1])) {
|
||||
/* (a || a) == a */
|
||||
return ir->operands[0];
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue