Mesa (master): nir/cf: Fix unlink_block_successors to actually unlink the second one.

Kenneth Graunke kwg at kemper.freedesktop.org
Wed Sep 23 18:03:15 UTC 2015


Module: Mesa
Branch: master
Commit: 6560838703431f89c47d68822758bc76fd34c355
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=6560838703431f89c47d68822758bc76fd34c355

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Tue Sep  1 22:56:29 2015 -0700

nir/cf: Fix unlink_block_successors to actually unlink the second one.

Calling unlink_blocks(block, block->successors[0]) will successfully
unlink the first successor, but then will shift block->successors[1]
down to block->successor[0].  So the successors[1] != NULL check will
always fail.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Connor Abbott <cwabbott0 at gmail.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand at intel.com>

---

 src/glsl/nir/nir_control_flow.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/glsl/nir/nir_control_flow.c b/src/glsl/nir/nir_control_flow.c
index 87bc716..55d0689 100644
--- a/src/glsl/nir/nir_control_flow.c
+++ b/src/glsl/nir/nir_control_flow.c
@@ -99,10 +99,10 @@ unlink_blocks(nir_block *pred, nir_block *succ)
 static void
 unlink_block_successors(nir_block *block)
 {
-   if (block->successors[0] != NULL)
-      unlink_blocks(block, block->successors[0]);
    if (block->successors[1] != NULL)
       unlink_blocks(block, block->successors[1]);
+   if (block->successors[0] != NULL)
+      unlink_blocks(block, block->successors[0]);
 }
 
 static void




More information about the mesa-commit mailing list