From da9c8a462707c85de19720901fe1e299c95f191c Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Mon, 6 Mar 2023 22:59:23 -0500 Subject: [PATCH] agx: Assert that we don't overflow registers This will become particularly important when we bound to smaller register files. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/asahi/compiler/agx_register_allocate.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/asahi/compiler/agx_register_allocate.c b/src/asahi/compiler/agx_register_allocate.c index d46ce903a30..27da7da92c9 100644 --- a/src/asahi/compiler/agx_register_allocate.c +++ b/src/asahi/compiler/agx_register_allocate.c @@ -215,6 +215,7 @@ reserve_live_in(struct ra_ctx *rctx) static void assign_regs(struct ra_ctx *rctx, agx_index v, unsigned reg) { + assert(reg < rctx->bound && "must not overflow register file"); assert(v.type == AGX_INDEX_NORMAL && "only SSA gets registers allocated"); rctx->ssa_to_reg[v.value] = reg;