From 00d7ad334a123b057bcbf19c014be53f269856cf Mon Sep 17 00:00:00 2001 From: Connor Abbott Date: Wed, 29 Sep 2021 12:36:49 +0200 Subject: [PATCH] ir3/legalize: Handle inserting (ei) with preamble Make sure that shaders with a preamble are still considered early-release so that we don't regress them. Part-of: --- src/freedreno/ir3/ir3.h | 13 +++++++++++++ src/freedreno/ir3/ir3_legalize.c | 4 ++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/freedreno/ir3/ir3.h b/src/freedreno/ir3/ir3.h index e73eca38512..ca46d3bd4ca 100644 --- a/src/freedreno/ir3/ir3.h +++ b/src/freedreno/ir3/ir3.h @@ -661,6 +661,19 @@ ir3_start_block(struct ir3 *ir) return list_first_entry(&ir->block_list, struct ir3_block, node); } +static inline struct ir3_block * +ir3_after_preamble(struct ir3 *ir) +{ + struct ir3_block *block = ir3_start_block(ir); + /* The preamble will have a usually-empty else branch, and we want to skip + * that to get to the block after the preamble. + */ + if (block->brtype == IR3_BRANCH_SHPS) + return block->successors[1]->successors[0]; + else + return block; +} + void ir3_block_add_predecessor(struct ir3_block *block, struct ir3_block *pred); void ir3_block_add_physical_predecessor(struct ir3_block *block, struct ir3_block *pred); diff --git a/src/freedreno/ir3/ir3_legalize.c b/src/freedreno/ir3/ir3_legalize.c index dc25fe1f2ee..7ad2addbd85 100644 --- a/src/freedreno/ir3/ir3_legalize.c +++ b/src/freedreno/ir3/ir3_legalize.c @@ -136,7 +136,7 @@ legalize_block(struct ir3_legalize_ctx *ctx, struct ir3_block *block) * with the end of the program. */ assert(input_count == 0 || !ctx->early_input_release || - block == ir3_start_block(block->shader)); + block == ir3_after_preamble(block->shader)); /* remove all the instructions from the list, we'll be adding * them back in as we go @@ -953,7 +953,7 @@ ir3_legalize(struct ir3 *ir, struct ir3_shader_variant *so, int *max_bary) * a5xx and a6xx do automatically release varying storage at the end. */ ctx->early_input_release = true; - struct ir3_block *start_block = ir3_start_block(ir); + struct ir3_block *start_block = ir3_after_preamble(ir); foreach_block (block, &ir->block_list) { foreach_instr (instr, &block->instr_list) { if (is_input(instr) && block != start_block) {