pan/bi: Fix emit_if successor assignment
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Wed, 27 May 2020 22:27:08 +0000 (18:27 -0400)
committerMarge Bot <eric+marge@anholt.net>
Fri, 29 May 2020 20:34:55 +0000 (20:34 +0000)
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Fixes: 9a00cf3d1ef ("pan/bi: Add support for if-else blocks")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5260>

src/panfrost/bifrost/bifrost_compile.c

index 2404d988aaec0a77cc2b85ca1fd8aca7cbc8de5c..1e41b53e435e67aea8f7f5352bfd9982edd45ec0 100644 (file)
@@ -1084,18 +1084,16 @@ emit_if(bi_context *ctx, nir_if *nif)
                 /* The else block is empty, so don't emit an exit jump */
                 bi_remove_instruction(then_exit);
                 then_branch->branch_target = ctx->after_block;
                 /* The else block is empty, so don't emit an exit jump */
                 bi_remove_instruction(then_exit);
                 then_branch->branch_target = ctx->after_block;
+                pan_block_add_successor(&end_then_block->base, &ctx->after_block->base); /* fallthrough */
         } else {
                 then_branch->branch_target = else_block;
                 then_exit->branch_target = ctx->after_block;
                 pan_block_add_successor(&end_then_block->base, &then_exit->branch_target->base);
         } else {
                 then_branch->branch_target = else_block;
                 then_exit->branch_target = ctx->after_block;
                 pan_block_add_successor(&end_then_block->base, &then_exit->branch_target->base);
+                pan_block_add_successor(&end_else_block->base, &ctx->after_block->base); /* fallthrough */
         }
 
         }
 
-        /* Wire up the successors */
-
         pan_block_add_successor(&before_block->base, &then_branch->branch_target->base); /* then_branch */
         pan_block_add_successor(&before_block->base, &then_branch->branch_target->base); /* then_branch */
-
         pan_block_add_successor(&before_block->base, &then_block->base); /* fallthrough */
         pan_block_add_successor(&before_block->base, &then_block->base); /* fallthrough */
-        pan_block_add_successor(&end_else_block->base, &ctx->after_block->base); /* fallthrough */
 }
 
 static void
 }
 
 static void