pan/bi: Cull unnecessary edges on the CF graph
If a block ends in an unconditional jump, we don't need to record a fallthrough successor as well, since it's unreachable. Likely harmless but makes the IR harder to parse with messy CF graphs. 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/7081>
This commit is contained in:
@@ -72,6 +72,7 @@ emit_jump(bi_context *ctx, nir_jump_instr *instr)
|
||||
}
|
||||
|
||||
pan_block_add_successor(&ctx->current_block->base, &branch->branch_target->base);
|
||||
ctx->current_block->base.unconditional_jumps = true;
|
||||
}
|
||||
|
||||
static bi_instruction
|
||||
|
||||
@@ -81,6 +81,10 @@ pan_block_add_successor(pan_block *block, pan_block *successor)
|
||||
assert(block);
|
||||
assert(successor);
|
||||
|
||||
/* Cull impossible edges */
|
||||
if (block->unconditional_jumps)
|
||||
return;
|
||||
|
||||
for (unsigned i = 0; i < ARRAY_SIZE(block->successors); ++i) {
|
||||
if (block->successors[i]) {
|
||||
if (block->successors[i] == successor)
|
||||
|
||||
@@ -129,6 +129,7 @@ typedef struct pan_block {
|
||||
/* Control flow graph */
|
||||
struct pan_block *successors[2];
|
||||
struct set *predecessors;
|
||||
bool unconditional_jumps;
|
||||
|
||||
/* In liveness analysis, these are live masks (per-component) for
|
||||
* indices for the block. Scalar compilers have the luxury of using
|
||||
|
||||
Reference in New Issue
Block a user