[Mesa-dev] [PATCH 1/5] nir: Don't insert a fake link if unnecessary.
Kenneth Graunke
kenneth at whitecape.org
Thu Sep 3 11:32:15 PDT 2015
Prevents regressions in ~128 tests when fixing unlink_block_successors
in the next commit.
XXX: Zero thought has been put into whether this is the right solution
Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
src/glsl/nir/nir_control_flow.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
The problem is that this fake link causes the same block to be
block->successors[0] and block->successors[1]...
diff --git a/src/glsl/nir/nir_control_flow.c b/src/glsl/nir/nir_control_flow.c
index 5c03375..d0b2a10 100644
--- a/src/glsl/nir/nir_control_flow.c
+++ b/src/glsl/nir/nir_control_flow.c
@@ -542,13 +542,15 @@ void unlink_jump(nir_block *block, nir_jump_type type)
nir_loop *loop =
nir_cf_node_as_loop(nir_cf_node_prev(&next->cf_node));
- /* insert fake link */
+ /* insert fake link if necessary */
nir_cf_node *last = nir_loop_last_cf_node(loop);
assert(last->type == nir_cf_node_block);
nir_block *last_block = nir_cf_node_as_block(last);
- last_block->successors[1] = next;
- block_add_pred(next, last_block);
+ if (last_block->successors[0] != next) {
+ last_block->successors[1] = next;
+ block_add_pred(next, last_block);
+ }
}
}
--
2.5.0
More information about the mesa-dev
mailing list