Mesa (master): v3d/compiler: don't rewrite unused temporaries to point to NOP register

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jun 26 09:28:51 UTC 2020


Module: Mesa
Branch: master
Commit: 4845f184d767edebb952a0a1a0f9af769b651656
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=4845f184d767edebb952a0a1a0f9af769b651656

Author: Iago Toral Quiroga <itoral at igalia.com>
Date:   Thu Jun 25 11:54:04 2020 +0200

v3d/compiler: don't rewrite unused temporaries to point to NOP register

This was assuming that unused temporaries are written but never read,
since the NOP register can only be used as a destination register,
but we can end up here also for temporaries that are read once but
never written.

This was found with a graphicsfuzz test that has a switch with
cases that have unreachable discards. In that test, NIR genrates
code like this:

decl_reg vec3 32 r19
...
r20 = mov r19.z
r21 = mov r19.y
r22 = mov r19.x

Where r19.xyz would generate 3 temporary registers that are read but
never written, so we would rewrite them to point to the NOP register
as QPU instruction sources, which is not allowed and would hit an
assert that expect magic reads to be from [r0,r5] only.

Fixes:
dEQP-VK.graphicsfuzz.unreachable-switch-case-with-discards

Reviewed-by: Alejandro Piñeiro <apinheiro at igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5645>

---

 src/broadcom/compiler/vir_register_allocate.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/src/broadcom/compiler/vir_register_allocate.c b/src/broadcom/compiler/vir_register_allocate.c
index d88a8df1141..eac027f9e67 100644
--- a/src/broadcom/compiler/vir_register_allocate.c
+++ b/src/broadcom/compiler/vir_register_allocate.c
@@ -678,14 +678,6 @@ v3d_register_allocate(struct v3d_compile *c, bool *spilled)
                         temp_registers[i].magic = false;
                         temp_registers[i].index = ra_reg - PHYS_INDEX;
                 }
-
-                /* If the value's never used, just write to the NOP register
-                 * for clarity in debug output.
-                 */
-                if (c->temp_start[i] == c->temp_end[i]) {
-                        temp_registers[i].magic = true;
-                        temp_registers[i].index = V3D_QPU_WADDR_NOP;
-                }
         }
 
         ralloc_free(g);



More information about the mesa-commit mailing list