agx: fix phi translation corruption

we can't stomp over srcs[], where we allocated our space for sources. unclear
how this worked before but it definitely breaks once you have a phi with 7
sources.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29179>
This commit is contained in:
Alyssa Rosenzweig 2024-04-17 09:48:36 -04:00 committed by Marge Bot
parent f21dbfe5ae
commit 94f0209fb2
2 changed files with 8 additions and 9 deletions

View file

@ -2146,6 +2146,7 @@ static void
agx_emit_phi_deferred(agx_context *ctx, agx_block *block, agx_instr *I)
{
nir_phi_instr *phi = I->phi;
I->phi = NULL;
/* Guaranteed by lower_phis_to_scalar */
assert(phi->def.num_components == 1);

View file

@ -309,15 +309,8 @@ typedef struct {
/* Must be first */
struct list_head link;
/* The sources list.
*
* As a special case to workaround ordering issues when translating phis, if
* nr_srcs == 0 and the opcode is PHI, holds a pointer to the NIR phi node.
*/
union {
agx_index *src;
nir_phi_instr *phi;
};
/* The sources list. */
agx_index *src;
/* Data flow */
agx_index *dest;
@ -348,6 +341,11 @@ typedef struct {
enum agx_atomic_opc atomic_opc;
enum agx_lod_mode lod_mode;
struct agx_block *target;
/* As a special case to workaround ordering issues when translating phis,
* if nr_srcs == 0 and the opcode is PHI, points to the NIR phi.
*/
nir_phi_instr *phi;
};
/* For local access */