jay: Make lower_immediates bail if there are no sources

For example, JAY_OPCODE_PRELOAD has no sources.  Reading src[other]
would read uninitialized data.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40960>
This commit is contained in:
Kenneth Graunke 2026-04-13 12:34:26 -07:00 committed by Marge Bot
parent a79931421c
commit 8bfb139033

View file

@ -143,6 +143,9 @@ try_swap_src01(jay_inst *I)
static void
lower_immediates(jay_builder *b, jay_inst *I, struct hash_table_u64 *constants)
{
if (I->num_srcs == 0)
return;
/* Canonicalize compare-with-zero to increase freedom */
if (I->op == JAY_OPCODE_CMP &&
jay_is_zero(I->src[1]) &&