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@gmail.com>
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;
}