[Mesa-dev] [PATCH 064/133] nir/nir: Fix a bug in move_successors

Jason Ekstrand jason at jlekstrand.net
Mon Dec 15 22:05:14 PST 2014


The unlink_blocks function moves successors around to make sure that, if
there is a remaining successor, it is in the first successors slot and not
the second.  To fix this, we simply get both successors up front.
---
 src/glsl/nir/nir.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/glsl/nir/nir.c b/src/glsl/nir/nir.c
index f7bee9d..060359a 100644
--- a/src/glsl/nir/nir.c
+++ b/src/glsl/nir/nir.c
@@ -733,10 +733,11 @@ static void
 move_successors(nir_block *source, nir_block *dest)
 {
    nir_block *succ1 = source->successors[0];
+   nir_block *succ2 = source->successors[1];
+
    if (succ1)
       unlink_blocks(source, succ1);
 
-   nir_block *succ2 = source->successors[1];
    if (succ2)
       unlink_blocks(source, succ2);
 
-- 
2.2.0



More information about the mesa-dev mailing list