From: Thomas Helland <thomashellan...@gmail.com> And it's cousins
Signed-off-by: Thomas Helland <thomashellan...@gmail.com> --- src/glsl/opt_algebraic.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp index 748fd05..230fb1b 100644 --- a/src/glsl/opt_algebraic.cpp +++ b/src/glsl/opt_algebraic.cpp @@ -559,6 +559,16 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir) ir->operands[0]->equals(op_expr[1]->operands[0])) { /* A && !A == 0 */ return ir_constant::zero(mem_ctx, ir->type); + } else if (op_expr[0] && op_expr[0]->operation == ir_binop_logic_or && + (op_expr[0]->operands[0]->equals(ir->operands[1]) || + op_expr[0]->operands[1]->equals(ir->operands[1]))) { + /* (A || B) && A == A or (B || A) && A == A */ + return ir->operands[1]; + } else if (op_expr[1] && op_expr[1]->operation == ir_binop_logic_or && + (op_expr[1]->operands[0]->equals(ir->operands[0]) || + op_expr[1]->operands[1]->equals(ir->operands[0]))) { + /* A && (A || B) == A or A && (B || A) == A */ + return ir->operands[1]; } break; -- 2.0.0 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev