summaryrefslogtreecommitdiffstats
path: root/src/glsl/nir/nir_control_flow.c
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2015-09-03 00:31:19 -0700
committerKenneth Graunke <[email protected]>2015-09-23 10:59:59 -0700
commite2637db618b868682e1c996b3c6394c2e82963f1 (patch)
tree530072f26a083526c3a09f67120e577388d64ea9 /src/glsl/nir/nir_control_flow.c
parent6a67ede6b33cfb3bc35d09dcd25a731cba3b7780 (diff)
nir/cf: Make a helper function for removing a predecessor.
I need to do this in a second place, and I'd rather make a helper function than cut and paste the code. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Connor Abbott <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/glsl/nir/nir_control_flow.c')
-rw-r--r--src/glsl/nir/nir_control_flow.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/glsl/nir/nir_control_flow.c b/src/glsl/nir/nir_control_flow.c
index 768dfd2aff3..43e4e43aede 100644
--- a/src/glsl/nir/nir_control_flow.c
+++ b/src/glsl/nir/nir_control_flow.c
@@ -60,6 +60,16 @@ block_add_pred(nir_block *block, nir_block *pred)
_mesa_set_add(block->predecessors, pred);
}
+static inline void
+block_remove_pred(nir_block *block, nir_block *pred)
+{
+ struct set_entry *entry = _mesa_set_search(block->predecessors, pred);
+
+ assert(entry);
+
+ _mesa_set_remove(block->predecessors, entry);
+}
+
static void
link_blocks(nir_block *pred, nir_block *succ1, nir_block *succ2)
{
@@ -83,11 +93,7 @@ unlink_blocks(nir_block *pred, nir_block *succ)
pred->successors[1] = NULL;
}
- struct set_entry *entry = _mesa_set_search(succ->predecessors, pred);
-
- assert(entry);
-
- _mesa_set_remove(succ->predecessors, entry);
+ block_remove_pred(succ, pred);
}
static void