Seems reasonable

Reviewed-by: Jason Ekstrand <ja...@jlekstrand.net>

On Wed, Aug 15, 2018 at 4:58 PM Caio Marcelo de Oliveira Filho <
caio.olive...@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@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to