diff --git a/src/nouveau/compiler/nak_nir_lower_cf.c b/src/nouveau/compiler/nak_nir_lower_cf.c index 01276c4a4db..817f6de4d73 100644 --- a/src/nouveau/compiler/nak_nir_lower_cf.c +++ b/src/nouveau/compiler/nak_nir_lower_cf.c @@ -442,6 +442,14 @@ lower_cf_func(nir_function *func) /* We use this in block_is_merge() */ nir_metadata_require(old_impl, nir_metadata_dominance | nir_metadata_divergence); + /* We get rid of single source phis, because they would be converted to phis + * with undef after lowering regs to SSA. + */ + nir_foreach_block(block, old_impl) { + if (nir_block_num_preds(block) <= 1) + nir_remove_single_src_phis_block(block); + } + /* First, we temporarily get rid of SSA. This will make all our block * motion way easier. Ask the pass to place reg writes directly in the * immediate predecessors of the phis instead of trying to be clever.