From d78e309e4d400a0a7076880c48cbbf35179f645e Mon Sep 17 00:00:00 2001 From: Job Noorman Date: Wed, 11 Mar 2026 09:07:37 +0100 Subject: [PATCH] ir3: update context builder after ir3_get_predicate If we are currently inserting instructions after the src of the predicate conversion, uses of the predicate will be inserted before its def (the conversion). Fix this by updating the context builder to point to after the conversion. Signed-off-by: Job Noorman Fixes: fda91b49d71 ("ir3: refactor builders to use ir3_builder API") Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/15043 (cherry picked from commit f88e8b778d9566ff5510bba8ea35973920def878) Part-of: --- .pick_status.json | 2 +- src/freedreno/ir3/ir3_context.c | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.pick_status.json b/.pick_status.json index 9d2cf1032c8..5e987fd1de5 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -154,7 +154,7 @@ "description": "ir3: update context builder after ir3_get_predicate", "nominated": true, "nomination_type": 2, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "fda91b49d71dcb7b5368920c3bc97faad0848eb2", "notes": null diff --git a/src/freedreno/ir3/ir3_context.c b/src/freedreno/ir3/ir3_context.c index ba3744a41e4..d93a85c872a 100644 --- a/src/freedreno/ir3/ir3_context.c +++ b/src/freedreno/ir3/ir3_context.c @@ -456,6 +456,16 @@ ir3_get_predicate(struct ir3_context *ctx, struct ir3_instruction *src) } _mesa_hash_table_insert(ctx->predicate_conversions, src, cond); + + /* If we are currently emitting instructions after src, update the context + * builder to point after the predicate conversion. Otherwise, we will insert + * its uses before its def. + */ + if (ctx->build.cursor.option == IR3_CURSOR_AFTER_INSTR && + ctx->build.cursor.instr == src) { + ctx->build = b; + } + return cond; }