From 90e3310086dbcfaa782c27f8c552426ea866dbe4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Ondra=C4=8Dka?= Date: Mon, 3 Jan 2022 15:47:43 +0100 Subject: [PATCH] r300: Remove broken optimization in rc_transform_KILL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The logic was reversed so this was not only not working but it was also removing random instructions around. The special IF-KILP-ENDIF case this optimization was targeting is already transformed to KILL_IF in the TGSI, so just remove this altogether. This fixes piglit glsl-fs-discard-04 v2: Update the comment as well Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/343 Signed-off-by: Pavel Ondračka Reviewed-by: Filip Gawin Reviewed-by: Marek Olšák Reviewed-by: Emma Anholt Cc: mesa-stable Part-of: (cherry picked from commit 96ad4f64375905c710f881e6972784f597799457) --- .pick_status.json | 2 +- .../r300/compiler/radeon_program_alu.c | 21 ------------------- 2 files changed, 1 insertion(+), 22 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 9d958a09907..8047b12c618 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -2533,7 +2533,7 @@ "description": "r300: Remove broken optimization in rc_transform_KILL", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null }, diff --git a/src/gallium/drivers/r300/compiler/radeon_program_alu.c b/src/gallium/drivers/r300/compiler/radeon_program_alu.c index 9d96307f117..a2416c5503d 100644 --- a/src/gallium/drivers/r300/compiler/radeon_program_alu.c +++ b/src/gallium/drivers/r300/compiler/radeon_program_alu.c @@ -1215,12 +1215,6 @@ int radeonTransformDeriv(struct radeon_compiler* c, * * === OR === * - * IF Temp[0].x -\ - * KILL - > KIL -abs(Temp[0].x) - * ENDIF -/ - * - * === OR === - * * IF Temp[0].x -> IF Temp[0].x * ... -> ... * ELSE -> ELSE @@ -1265,21 +1259,6 @@ void rc_transform_KILL(struct radeon_compiler * c, void *user) * block, because -0.0 is considered negative. */ inst->U.I.SrcReg[0] = negate(absolute(if_inst->U.I.SrcReg[0])); - - if (inst->Prev->U.I.Opcode != RC_OPCODE_IF - && inst->Next->U.I.Opcode != RC_OPCODE_ENDIF) { - - /* Optimize the special case: - * IF Temp[0].x - * KILP - * ENDIF - */ - - /* Remove IF */ - rc_remove_instruction(inst->Prev); - /* Remove ENDIF */ - rc_remove_instruction(inst->Next); - } } } }