panfrost/midgard: Fix off-by-one in successor analysis
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>
Sun, 21 Apr 2019 19:12:10 +0000 (19:12 +0000)
committerAlyssa Rosenzweig <alyssa@rosenzweig.io>
Wed, 24 Apr 2019 02:22:31 +0000 (02:22 +0000)
This reduces register pressure substantially since we get smaller
liveness ranges.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
src/gallium/drivers/panfrost/midgard/midgard_compile.c

index 444d5a32dd20013760e8865cc7e7b4ffb60a2b2d..fcc17a5a092c34a73d3745d6ee37323bdaded67e 100644 (file)
@@ -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) */