[Mesa-dev] [PATCH 14/21] nir/cf: Handle relinking top-level blocks

Connor Abbott cwabbott0 at gmail.com
Thu Feb 25 06:40:04 UTC 2016


Reviewed-by: Connor Abbott <cwabbott0 at gmail.com>

On Sat, Feb 13, 2016 at 9:14 PM, Jason Ekstrand <jason at jlekstrand.net> wrote:
> This can happen if a function ends in a return instruction and you remove
> the return.
> ---
>  src/compiler/nir/nir_control_flow.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/src/compiler/nir/nir_control_flow.c b/src/compiler/nir/nir_control_flow.c
> index 96395a4..ecd9cbd 100644
> --- a/src/compiler/nir/nir_control_flow.c
> +++ b/src/compiler/nir/nir_control_flow.c
> @@ -336,8 +336,7 @@ block_add_normal_succs(nir_block *block)
>           nir_block *next_block = nir_cf_node_as_block(next);
>
>           link_blocks(block, next_block, NULL);
> -      } else {
> -         assert(parent->type == nir_cf_node_loop);
> +      } else if (parent->type == nir_cf_node_loop) {
>           nir_loop *loop = nir_cf_node_as_loop(parent);
>
>           nir_cf_node *head = nir_loop_first_cf_node(loop);
> @@ -346,6 +345,10 @@ block_add_normal_succs(nir_block *block)
>
>           link_blocks(block, head_block, NULL);
>           insert_phi_undef(head_block, block);
> +      } else {
> +         assert(parent->type == nir_cf_node_function);
> +         nir_function_impl *impl = nir_cf_node_as_function(parent);
> +         link_blocks(block, impl->end_block, NULL);
>        }
>     } else {
>        nir_cf_node *next = nir_cf_node_next(&block->cf_node);
> --
> 2.5.0.400.gff86faf
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list