From: Kenneth Graunke Date: Wed, 2 Sep 2015 05:56:29 +0000 (-0700) Subject: nir/cf: Fix unlink_block_successors to actually unlink the second one. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6560838703431f89c47d68822758bc76fd34c355;p=mesa.git 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 Reviewed-by: Connor Abbott Reviewed-by: Jason Ekstrand --- diff --git a/src/glsl/nir/nir_control_flow.c b/src/glsl/nir/nir_control_flow.c index 87bc7163efd..55d0689c45e 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