pan/bi: Passthrough deps of the branch target
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Thu, 28 May 2020 19:38:04 +0000 (15:38 -0400)
committerMarge Bot <eric+marge@anholt.net>
Fri, 29 May 2020 20:34:56 +0000 (20:34 +0000)
Now that we have the infrastructure, follow the branch.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5260>

src/panfrost/bifrost/bi_pack.c

index 9a5da020ca78b3e235f535a20398779022cd3189..ecb315fae0aa3dfc3385d748f7c3abb3d04d3536 100644 (file)
@@ -1904,8 +1904,12 @@ bi_pack_clause(bi_context *ctx, bi_clause *clause,
 static bi_clause *
 bi_next_clause(bi_context *ctx, pan_block *block, bi_clause *clause)
 {
+        /* Try the first clause in this block if we're starting from scratch */
+        if (!clause && !list_is_empty(&((bi_block *) block)->clauses))
+                return list_first_entry(&((bi_block *) block)->clauses, bi_clause, link);
+
         /* Try the next clause in this block */
-        if (clause->link.next != &((bi_block *) block)->clauses)
+        if (clause && clause->link.next != &((bi_block *) block)->clauses)
                 return list_first_entry(&(clause->link), bi_clause, link);
 
         /* Try the next block, or the one after that if it's empty, etc .*/
@@ -1929,9 +1933,19 @@ bi_pack(bi_context *ctx, struct util_dynarray *emission)
         bi_foreach_block(ctx, _block) {
                 bi_block *block = (bi_block *) _block;
 
+                /* Passthrough the first clause of where we're branching to for
+                 * the last clause of the block (the clause with the branch) */
+
+                bi_clause *succ_clause = block->base.successors[1] ?
+                        bi_next_clause(ctx, block->base.successors[0], NULL) : NULL;
+
                 bi_foreach_clause_in_block(block, clause) {
+                        bool is_last = clause->link.next == &block->clauses;
+
                         bi_clause *next = bi_next_clause(ctx, _block, clause);
-                        bi_pack_clause(ctx, clause, next, NULL, emission, ctx->stage);
+                        bi_clause *next_2 = is_last ? succ_clause : NULL;
+
+                        bi_pack_clause(ctx, clause, next, next_2, emission, ctx->stage);
                 }
         }
 }