summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTimothy Arceri <tarceri@itsqueeze.com>2019-02-14 12:27:25 +1100
committerTimothy Arceri <tarceri@itsqueeze.com>2019-02-16 10:45:31 +1100
commita801196ec9c200318a667021d1b4e0820228a507 (patch)
treed6f9ded3bfa307d751d9f33669638672fd695d1b /src
parentf695e433542847cc396b6b55c6f6e912a196a107 (diff)
nir: remove simple dead if detection from nir_opt_dead_cf()
This was probably useful when it was first written, however it looks to be no longer necessary. As far as I can tell these days dce is smart enough to remove useless instructions from if branches. Once this is done nir_opt_peephole_select() will end up removing the empty if. Removing this support reduces the dolphin uber shader compilation time spent in nir_opt_dead_cf() by a little over 7x. No shader-db changes on i965 or radeonsi. Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/compiler/nir/nir_opt_dead_cf.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/compiler/nir/nir_opt_dead_cf.c b/src/compiler/nir/nir_opt_dead_cf.c
index e796e6e85e3..4cacfed1119 100644
--- a/src/compiler/nir/nir_opt_dead_cf.c
+++ b/src/compiler/nir/nir_opt_dead_cf.c
@@ -164,7 +164,7 @@ def_only_used_in_cf_node(nir_ssa_def *def, void *_node)
}
/*
- * Test if a loop node or if node is dead. Such nodes are dead if:
+ * Test if a loop node is dead. Such nodes are dead if:
*
* 1) It has no side effects (i.e. intrinsics which could possibly affect the
* state of the program aside from producing an SSA value, indicated by a lack
@@ -182,7 +182,7 @@ def_only_used_in_cf_node(nir_ssa_def *def, void *_node)
static bool
node_is_dead(nir_cf_node *node)
{
- assert(node->type == nir_cf_node_loop || node->type == nir_cf_node_if);
+ assert(node->type == nir_cf_node_loop);
nir_block *after = nir_cf_node_as_block(nir_cf_node_next(node));
@@ -239,11 +239,6 @@ dead_cf_block(nir_block *block)
{
nir_if *following_if = nir_block_get_following_if(block);
if (following_if) {
- if (node_is_dead(&following_if->cf_node)) {
- nir_cf_node_remove(&following_if->cf_node);
- return true;
- }
-
if (!nir_src_is_const(following_if->condition))
return false;