diff options
author | Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> | 2020-10-02 13:06:54 -0400 |
---|---|---|
committer | Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> | 2020-10-10 16:53:09 -0400 |
commit | c8b9a05f9e71ebecf78b5954972a643fd671837c (patch) | |
tree | c0bcdac60d4e39617617c513c2a6fdb4819b9d1b /src/panfrost | |
parent | 026a29506e4d103f54e3ccb1d7bc483b7369a093 (diff) |
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>
Diffstat (limited to 'src/panfrost')
-rw-r--r-- | src/panfrost/bifrost/bifrost_compile.c | 1 | ||||
-rw-r--r-- | src/panfrost/util/pan_ir.c | 4 | ||||
-rw-r--r-- | src/panfrost/util/pan_ir.h | 1 |
3 files changed, 6 insertions, 0 deletions
diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c index 203dc566ed2..25a6bb6fc60 100644 --- a/src/panfrost/bifrost/bifrost_compile.c +++ b/src/panfrost/bifrost/bifrost_compile.c @@ -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 diff --git a/src/panfrost/util/pan_ir.c b/src/panfrost/util/pan_ir.c index 4fdb9ebabff..a58fa631843 100644 --- a/src/panfrost/util/pan_ir.c +++ b/src/panfrost/util/pan_ir.c @@ -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) diff --git a/src/panfrost/util/pan_ir.h b/src/panfrost/util/pan_ir.h index f916d40e800..dec35bcd2f1 100644 --- a/src/panfrost/util/pan_ir.h +++ b/src/panfrost/util/pan_ir.h @@ -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 |