pan/bi: Fix jumps to terminal block again

New scheduler broke this. We need to shuffle some code around so we do
the lower pre-schedule instead of post-schedule (no clauses to work
with).

Fixes: 77933d16d8 ("pan/bi: Switch to new scheduler")
Reported-by: Icecream95 <ixn@disroot.org>
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9011>
This commit is contained in:
Alyssa Rosenzweig 2021-02-11 15:23:01 -05:00 committed by Marge Bot
parent 44c0672fd4
commit a805d999c0
2 changed files with 11 additions and 5 deletions

View File

@ -2424,10 +2424,12 @@ bifrost_nir_lower_i8_fragout(nir_shader *shader)
}
/* Dead code elimination for branches at the end of a block - only one branch
* per block is legal semantically, but unreachable jumps can be generated */
* per block is legal semantically, but unreachable jumps can be generated.
* Likewise we can generate jumps to the terminal block which need to be
* lowered away to a jump to #0x0, which induces successful termination. */
static void
bi_cull_dead_branch(bi_block *block)
bi_lower_branch(bi_block *block)
{
bool branched = false;
ASSERTED bool was_jump = false;
@ -2436,12 +2438,16 @@ bi_cull_dead_branch(bi_block *block)
if (!ins->branch_target) continue;
if (branched) {
assert(was_jump);
assert(was_jump && (ins->op == BI_OPCODE_JUMP));
bi_remove_instruction(ins);
break;
}
branched = true;
was_jump = ins->op == BI_OPCODE_JUMP;
if (bi_is_terminal_block(ins->branch_target))
ins->branch_target = NULL;
}
}
@ -2525,7 +2531,7 @@ bifrost_compile_shader_nir(void *mem_ctx, nir_shader *nir,
* consistent */
block->base.name = block_source_count++;
bi_cull_dead_branch(block);
bi_lower_branch(block);
}
/* Runs before copy prop */

View File

@ -784,7 +784,7 @@ bi_is_terminal_block(bi_block *block)
{
return block->base.successors[0] == NULL &&
block->base.successors[1] == NULL &&
list_is_empty(&block->clauses);
list_is_empty(&block->base.instructions);
}
/* Code emit */