agx: Consider "stop" a control flow instruction
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>
Thu, 22 Dec 2022 02:50:04 +0000 (21:50 -0500)
committerAlyssa Rosenzweig <alyssa@rosenzweig.io>
Thu, 5 Jan 2023 16:49:22 +0000 (11:49 -0500)
...and therefore it needs to be after a "logical end". This means that
"after_block_logical" will do the right thing for the last block.

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

src/asahi/compiler/agx_compile.c
src/asahi/compiler/agx_validate.c

index f6674d6..c23cb32 100644 (file)
@@ -1860,6 +1860,7 @@ agx_compile_function_nir(nir_shader *nir, nir_function_impl *impl,
     */
    agx_block *last_block = list_last_entry(&ctx->blocks, agx_block, link);
    agx_builder _b = agx_init_builder(ctx, agx_after_block(last_block));
+   agx_logical_end(&_b);
    agx_stop(&_b);
 
    /* Index blocks now that we're done emitting so the order is consistent */
index fc91ce8..6a09f1f 100644 (file)
@@ -83,6 +83,7 @@ agx_validate_block_form(agx_block *block)
       case AGX_OPCODE_IF_FCMP:
       case AGX_OPCODE_ELSE_FCMP:
       case AGX_OPCODE_WHILE_FCMP:
+      case AGX_OPCODE_STOP:
          agx_validate_assert(state == AGX_BLOCK_STATE_CF);
          break;
       }