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 <jnoorman@igalia.com>
Fixes: fda91b49d7 ("ir3: refactor builders to use ir3_builder API")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/15043
(cherry picked from commit f88e8b778d)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40359>
This commit is contained in:
Job Noorman 2026-03-11 09:07:37 +01:00 committed by Eric Engestrom
parent 0e31cb83ce
commit d78e309e4d
2 changed files with 11 additions and 1 deletions

View file

@ -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

View file

@ -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;
}