nir: add nir_loop::do_while to indicate do-while loops

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40349>
This commit is contained in:
Daniel Schürmann 2026-03-06 14:27:13 +01:00 committed by Marge Bot
parent 485586b184
commit 32436731a3
3 changed files with 4 additions and 0 deletions

View file

@ -3674,6 +3674,7 @@ typedef struct nir_loop {
nir_loop_info *info;
nir_loop_control control;
bool partially_unrolled;
bool do_while;
/**
* Whether some loop-active invocations might take a different control-flow path:

View file

@ -614,6 +614,7 @@ clone_loop(clone_state *state, struct exec_list *cf_list, const nir_loop *loop)
nir_loop *nloop = nir_loop_create(state->ns);
nloop->control = loop->control;
nloop->partially_unrolled = loop->partially_unrolled;
nloop->do_while = loop->do_while;
nir_cf_node_insert_end(cf_list, &nloop->cf_node);

View file

@ -1889,6 +1889,7 @@ write_loop(write_ctx *ctx, nir_loop *loop)
blob_write_uint8(ctx->blob, loop->control);
bool has_continue_construct = nir_loop_has_continue_construct(loop);
blob_write_uint8(ctx->blob, has_continue_construct);
blob_write_uint8(ctx->blob, loop->do_while);
write_cf_list(ctx, &loop->body);
if (has_continue_construct) {
@ -1905,6 +1906,7 @@ read_loop(read_ctx *ctx, struct exec_list *cf_list)
loop->control = blob_read_uint8(ctx->blob);
bool has_continue_construct = blob_read_uint8(ctx->blob);
loop->do_while = blob_read_uint8(ctx->blob);
read_cf_list(ctx, &loop->body);
if (has_continue_construct) {