From 8ed900c406f94e453ecf0b9129667fd9d480deaa Mon Sep 17 00:00:00 2001 From: Christoph Pillmayer Date: Wed, 4 Jun 2025 12:12:46 +0000 Subject: [PATCH] panvk: Fix start label position in cs_while_start We want the start label to be after the initial check for the condition not being true. Reviewed-by: Boris Brezillon Part-of: --- src/panfrost/genxml/cs_builder.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/panfrost/genxml/cs_builder.h b/src/panfrost/genxml/cs_builder.h index 81ae7490e73..c460b8a383d 100644 --- a/src/panfrost/genxml/cs_builder.h +++ b/src/panfrost/genxml/cs_builder.h @@ -1085,8 +1085,8 @@ cs_loop_diverge_ls_update(struct cs_builder *b, struct cs_loop *loop) } static inline struct cs_loop * -cs_do_while_start(struct cs_builder *b, struct cs_loop *loop, - enum mali_cs_condition cond, struct cs_index val) +cs_loop_init(struct cs_builder *b, struct cs_loop *loop, + enum mali_cs_condition cond, struct cs_index val) { *loop = (struct cs_loop){ .cond = cond, @@ -1096,7 +1096,6 @@ cs_do_while_start(struct cs_builder *b, struct cs_loop *loop, cs_block_start(b, &loop->block); cs_label_init(&loop->start); cs_label_init(&loop->end); - cs_set_label(b, &loop->start); return loop; } @@ -1104,7 +1103,7 @@ static inline struct cs_loop * cs_while_start(struct cs_builder *b, struct cs_loop *loop, enum mali_cs_condition cond, struct cs_index val) { - cs_do_while_start(b, loop, cond, val); + cs_loop_init(b, loop, cond, val); /* Do an initial check on the condition, and if it's false, jump to * the end of the loop block. For 'while(true)' loops, skip the @@ -1115,6 +1114,8 @@ cs_while_start(struct cs_builder *b, struct cs_loop *loop, cs_loop_diverge_ls_update(b, loop); } + cs_set_label(b, &loop->start); + return loop; }