From 652ff42f14958c922b68d4dcbb46701e9ce593b4 Mon Sep 17 00:00:00 2001 From: Emma Anholt Date: Wed, 22 Feb 2023 12:04:34 -0800 Subject: [PATCH] glsl/opt_algebraic: Drop x + -x -> 0 optimization. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit No change on freedreno shader-db. Acked-by: Timothy Arceri Reviewed-by: Marek Olšák Part-of: --- src/compiler/glsl/opt_algebraic.cpp | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/compiler/glsl/opt_algebraic.cpp b/src/compiler/glsl/opt_algebraic.cpp index 2d8f5cf3d10..e0987208062 100644 --- a/src/compiler/glsl/opt_algebraic.cpp +++ b/src/compiler/glsl/opt_algebraic.cpp @@ -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. */