summaryrefslogtreecommitdiffstats
path: root/src/compiler/nir/nir_opt_peephole_select.c
diff options
context:
space:
mode:
authorJason Ekstrand <jason.ekstrand@intel.com>2016-10-05 19:08:57 -0700
committerJason Ekstrand <jason.ekstrand@intel.com>2016-10-06 09:16:37 -0700
commit2ed17d46de045404042f13c6591895a1cf31b167 (patch)
treea3ae65b79f04ef673578382c631a045f371428e8 /src/compiler/nir/nir_opt_peephole_select.c
parent7a3bcadf4e665ff80775f520715061f4e3d63823 (diff)
downloadexternal_mesa3d-2ed17d46de045404042f13c6591895a1cf31b167.zip
external_mesa3d-2ed17d46de045404042f13c6591895a1cf31b167.tar.gz
external_mesa3d-2ed17d46de045404042f13c6591895a1cf31b167.tar.bz2
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 <jason@jlekstrand.net> Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Diffstat (limited to 'src/compiler/nir/nir_opt_peephole_select.c')
-rw-r--r--src/compiler/nir/nir_opt_peephole_select.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/compiler/nir/nir_opt_peephole_select.c b/src/compiler/nir/nir_opt_peephole_select.c
index 6a73d73..29543d6 100644
--- a/src/compiler/nir/nir_opt_peephole_select.c
+++ b/src/compiler/nir/nir_opt_peephole_select.c
@@ -157,17 +157,14 @@ nir_opt_peephole_select_block(nir_block *block, void *mem_ctx, unsigned limit)
return false;
nir_if *if_stmt = nir_cf_node_as_if(prev_node);
- nir_cf_node *then_node = nir_if_first_then_node(if_stmt);
- nir_cf_node *else_node = nir_if_first_else_node(if_stmt);
+ nir_block *then_block = nir_if_first_then_block(if_stmt);
+ nir_block *else_block = nir_if_first_else_block(if_stmt);
/* We can only have one block in each side ... */
- if (nir_if_last_then_node(if_stmt) != then_node ||
- nir_if_last_else_node(if_stmt) != else_node)
+ if (nir_if_last_then_block(if_stmt) != then_block ||
+ nir_if_last_else_block(if_stmt) != else_block)
return false;
- nir_block *then_block = nir_cf_node_as_block(then_node);
- nir_block *else_block = nir_cf_node_as_block(else_node);
-
/* ... and those blocks must only contain "allowed" instructions. */
unsigned count = 0;
if (!block_check_for_allowed_instrs(then_block, &count, limit != 0) ||