agx: Handle blocks with no predecessors
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>
Thu, 10 Aug 2023 17:36:55 +0000 (13:36 -0400)
committerMarge Bot <emma+marge@anholt.net>
Fri, 11 Aug 2023 20:31:28 +0000 (20:31 +0000)
This can come up with loops with SPIR-V. Fixes:

dEQP-VK.spirv_assembly.instruction.compute.loop_control.none

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24635>

src/asahi/compiler/agx_register_allocate.c

index ab41eb3..cb74e4b 100644 (file)
@@ -660,7 +660,11 @@ find_regs(struct ra_ctx *rctx, agx_instr *I, unsigned dest_idx, unsigned count,
 static void
 reserve_live_in(struct ra_ctx *rctx)
 {
+   /* If there are no predecessors, there is nothing live-in */
    unsigned nr_preds = agx_num_predecessors(rctx->block);
+   if (nr_preds == 0)
+      return;
+
    agx_builder b =
       agx_init_builder(rctx->shader, agx_before_block(rctx->block));