Skip to content

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

Iago Toral requested to merge itoral/mesa:v3d_unused_temp_nop into master

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

Edited by Iago Toral

Merge request reports

Loading