glsl/opt_algebraic: Drop x + -x -> 0 optimization.

No change on freedreno shader-db.

Acked-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21475>
This commit is contained in:
Emma Anholt
2023-02-22 12:04:34 -08:00
committed by Marge Bot
parent 69b178ac90
commit 652ff42f14

View File

@@ -322,18 +322,6 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir)
#undef HANDLE_PACK_UNPACK_INVERSE
case ir_binop_add:
/* Replace (x + (-x)) with constant 0 */
for (int i = 0; i < 2; i++) {
if (op_expr[i]) {
if (op_expr[i]->operation == ir_unop_neg) {
ir_rvalue *other = ir->operands[(i + 1) % 2];
if (other && op_expr[i]->operands[0]->equals(other)) {
return ir_constant::zero(ir, ir->type);
}
}
}
}
/* Reassociate addition of constants so that we can do constant
* folding.
*/