From 879ff866b68e0de0c56d5211b94b75cf443eda1f Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Sun, 21 Apr 2019 19:12:10 +0000 Subject: [PATCH] panfrost/midgard: Fix off-by-one in successor analysis This reduces register pressure substantially since we get smaller liveness ranges. Signed-off-by: Alyssa Rosenzweig --- src/gallium/drivers/panfrost/midgard/midgard_compile.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/panfrost/midgard/midgard_compile.c b/src/gallium/drivers/panfrost/midgard/midgard_compile.c index 444d5a32dd2..fcc17a5a092 100644 --- a/src/gallium/drivers/panfrost/midgard/midgard_compile.c +++ b/src/gallium/drivers/panfrost/midgard/midgard_compile.c @@ -3402,8 +3402,10 @@ emit_loop(struct compiler_context *ctx, nir_loop *nloop) br_back.branch.target_block = start_idx; emit_mir_instruction(ctx, br_back); - /* Mark down that branch in the graph */ - midgard_block_add_successor(ctx->current_block, start_block); + /* Mark down that branch in the graph. Note that we're really branching + * to the block *after* we started in. TODO: Why doesn't the branch + * itself have an off-by-one then...? */ + midgard_block_add_successor(ctx->current_block, start_block->successors[0]); /* Find the index of the block about to follow us (note: we don't add * one; blocks are 0-indexed so we get a fencepost problem) */ -- 2.30.2