[Mesa-dev] [PATCH 16/21] nir/cf: Make extracting or re-inserting nothing a no-op

Connor Abbott cwabbott0 at gmail.com
Thu Feb 25 06:46:35 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:
> ---
>  src/compiler/nir/nir_control_flow.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/src/compiler/nir/nir_control_flow.c b/src/compiler/nir/nir_control_flow.c
> index ecd9cbd..33b06d0 100644
> --- a/src/compiler/nir/nir_control_flow.c
> +++ b/src/compiler/nir/nir_control_flow.c
> @@ -749,6 +749,12 @@ nir_cf_extract(nir_cf_list *extracted, nir_cursor begin, nir_cursor end)
>  {
>     nir_block *block_begin, *block_end, *block_before, *block_after;
>
> +   if (nir_cursors_equal(begin, end)) {
> +      exec_list_make_empty(&extracted->list);
> +      extracted->impl = NULL; /* we shouldn't need this */
> +      return;
> +   }
> +
>     /* In the case where begin points to an instruction in some basic block and
>      * end points to the end of the same basic block, we rely on the fact that
>      * splitting on an instruction moves earlier instructions into a new basic
> @@ -788,6 +794,9 @@ nir_cf_reinsert(nir_cf_list *cf_list, nir_cursor cursor)
>  {
>     nir_block *before, *after;
>
> +   if (exec_list_is_empty(&cf_list->list))
> +      return;
> +
>     split_block_cursor(cursor, &before, &after);
>
>     foreach_list_typed_safe(nir_cf_node, node, node, &cf_list->list) {
> --
> 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