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

Caio Marcelo de Oliveira Filho caio.oliveira at intel.com
Wed Aug 15 21:56:35 UTC 2018


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;
 }
 
 static bool
-- 
2.18.0



More information about the mesa-dev mailing list