summaryrefslogtreecommitdiffstats
path: root/src/compiler/nir/nir_validate.c
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2016-10-05 19:08:57 -0700
committerJason Ekstrand <[email protected]>2016-10-06 09:16:37 -0700
commit2ed17d46de045404042f13c6591895a1cf31b167 (patch)
treea3ae65b79f04ef673578382c631a045f371428e8 /src/compiler/nir/nir_validate.c
parent7a3bcadf4e665ff80775f520715061f4e3d63823 (diff)
nir: Make nir_foo_first/last_cf_node return a block instead
One of NIR's invariants is that control flow lists always start and end with blocks. There's no good reason why we should return a cf_node from these functions since we know that it's always a block. Making it a block lets us remove a bunch of code. Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Connor Abbott <[email protected]>
Diffstat (limited to 'src/compiler/nir/nir_validate.c')
-rw-r--r--src/compiler/nir/nir_validate.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/compiler/nir/nir_validate.c b/src/compiler/nir/nir_validate.c
index 60af71550ba..bd73f0437f2 100644
--- a/src/compiler/nir/nir_validate.c
+++ b/src/compiler/nir/nir_validate.c
@@ -705,8 +705,7 @@ validate_block(nir_block *block, validate_state *state)
}
case nir_jump_continue: {
- nir_block *first =
- nir_cf_node_as_block(nir_loop_first_cf_node(state->loop));
+ nir_block *first = nir_loop_first_block(state->loop);
validate_assert(state, block->successors[0] == first);
break;
}
@@ -723,8 +722,7 @@ validate_block(nir_block *block, validate_state *state)
if (next == NULL) {
switch (state->parent_node->type) {
case nir_cf_node_loop: {
- nir_block *first =
- nir_cf_node_as_block(nir_loop_first_cf_node(state->loop));
+ nir_block *first = nir_loop_first_block(state->loop);
validate_assert(state, block->successors[0] == first);
/* due to the hack for infinite loops, block->successors[1] may
* point to the block after the loop.
@@ -751,15 +749,15 @@ validate_block(nir_block *block, validate_state *state)
} else {
if (next->type == nir_cf_node_if) {
nir_if *if_stmt = nir_cf_node_as_if(next);
- validate_assert(state, &block->successors[0]->cf_node ==
- nir_if_first_then_node(if_stmt));
- validate_assert(state, &block->successors[1]->cf_node ==
- nir_if_first_else_node(if_stmt));
+ validate_assert(state, block->successors[0] ==
+ nir_if_first_then_block(if_stmt));
+ validate_assert(state, block->successors[1] ==
+ nir_if_first_else_block(if_stmt));
} else {
validate_assert(state, next->type == nir_cf_node_loop);
nir_loop *loop = nir_cf_node_as_loop(next);
- validate_assert(state, &block->successors[0]->cf_node ==
- nir_loop_first_cf_node(loop));
+ validate_assert(state, block->successors[0] ==
+ nir_loop_first_block(loop));
validate_assert(state, block->successors[1] == NULL);
}
}