nir/nir: Fix a bug in move_successors
authorJason Ekstrand <jason.ekstrand@intel.com>
Sat, 8 Nov 2014 02:25:08 +0000 (18:25 -0800)
committerJason Ekstrand <jason.ekstrand@intel.com>
Thu, 15 Jan 2015 15:19:01 +0000 (07:19 -0800)
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.

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
src/glsl/nir/nir.c

index 56891dc340148bd461c6e9441dd302569ee50008..d0e09ebb34ef3cdf9393e4b41a1d80493e7b15a4 100644 (file)
@@ -739,10 +739,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);