Mesa (main): r300: Remove broken optimization in rc_transform_KILL

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jan 3 21:00:23 UTC 2022


Module: Mesa
Branch: main
Commit: 96ad4f64375905c710f881e6972784f597799457
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=96ad4f64375905c710f881e6972784f597799457

Author: Pavel Ondračka <pavel.ondracka at gmail.com>
Date:   Mon Jan  3 15:47:43 2022 +0100

r300: Remove broken optimization in rc_transform_KILL

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 <pavel.ondracka at gmail.com>
Reviewed-by: Filip Gawin <filip.gawin at zoho.com>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Reviewed-by: Emma Anholt <emma at anholt.net>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14378>

---

 .../drivers/r300/compiler/radeon_program_alu.c      | 21 ---------------------
 1 file changed, 21 deletions(-)

diff --git a/src/gallium/drivers/r300/compiler/radeon_program_alu.c b/src/gallium/drivers/r300/compiler/radeon_program_alu.c
index 8b813ea081d..a253d9bbab7 100644
--- a/src/gallium/drivers/r300/compiler/radeon_program_alu.c
+++ b/src/gallium/drivers/r300/compiler/radeon_program_alu.c
@@ -1127,12 +1127,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
@@ -1177,21 +1171,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);
-			}
 		}
 	}
 }



More information about the mesa-commit mailing list