[Mesa-dev] [PATCH 4/9] nir: Give end_block its own index

Jason Ekstrand jason at jlekstrand.net
Wed Aug 22 18:36:17 UTC 2018


Seems reasonable

Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>

On Wed, Aug 15, 2018 at 4:58 PM Caio Marcelo de Oliveira Filho <
caio.oliveira at intel.com> wrote:

> Since there's no particular reason for the index to be 0, choose an
> index that is not used by other block.  This is convenient when we
> store "per-block" data in an array AND look for the successors
> data (e.g. any kind of backwards data-flow analysis).
> ---
>  src/compiler/nir/nir.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/compiler/nir/nir.c b/src/compiler/nir/nir.c
> index e12aa5d80f5..1a5cfc27b74 100644
> --- a/src/compiler/nir/nir.c
> +++ b/src/compiler/nir/nir.c
> @@ -1641,7 +1641,7 @@ nir_index_blocks(nir_function_impl *impl)
>        block->index = index++;
>     }
>
> -   impl->num_blocks = index;
> +   impl->num_blocks = impl->end_block->index = index;
>

Mind dropping in a quick comment saying that end_block isn't really in the
program which is why it's index is >= num_blocks.


>  }
>
>  static bool
> --
> 2.18.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180822/7d26605c/attachment.html>


More information about the mesa-dev mailing list