Mesa (master): nir/dead_cf: Remove dead control flow after infinite loops.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Oct 11 15:46:47 UTC 2019


Module: Mesa
Branch: master
Commit: 6da3bf2600e52c16dac85439cb7eb5721e6c7b22
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=6da3bf2600e52c16dac85439cb7eb5721e6c7b22

Author: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
Date:   Fri Oct 11 14:49:05 2019 +0200

nir/dead_cf: Remove dead control flow after infinite loops.

And after discard-only loops. Otherwise we end up with dead code
which confuses nir_repair_ssa into adding a whole bunch of uses
of undefined. However, for derefs, we sometimes always expect to
get a variable instead of undefined.

Fixes dEQP-VK.graphicsfuzz.write-red-in-loop-nest on radv.

Fixes: c832820ce95 "nir/dead_cf: Repair SSA if the pass makes progress"
Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/1928
Reviewed-by: Connor Abbott <cwabbott0 at gmail.com>

---

 src/compiler/nir/nir_opt_dead_cf.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/compiler/nir/nir_opt_dead_cf.c b/src/compiler/nir/nir_opt_dead_cf.c
index 0a5c4a5de3c..a798da5d588 100644
--- a/src/compiler/nir/nir_opt_dead_cf.c
+++ b/src/compiler/nir/nir_opt_dead_cf.c
@@ -334,6 +334,13 @@ dead_cf_list(struct exec_list *list, bool *list_ends_in_jump)
          bool dummy;
          progress |= dead_cf_list(&loop->body, &dummy);
 
+         nir_block *next = nir_cf_node_as_block(nir_cf_node_next(cur));
+         if (next->predecessors->entries == 0 &&
+             (!exec_list_is_empty(&next->instr_list) ||
+             !exec_node_is_tail_sentinel(next->cf_node.node.next))) {
+            remove_after_cf_node(cur);
+            return true;
+         }
          break;
       }
 




More information about the mesa-commit mailing list