diff --git a/src/nouveau/compiler/nak_nir_lower_cf.c b/src/nouveau/compiler/nak_nir_lower_cf.c index f4a808412a4..b859b1964a9 100644 --- a/src/nouveau/compiler/nak_nir_lower_cf.c +++ b/src/nouveau/compiler/nak_nir_lower_cf.c @@ -445,10 +445,14 @@ lower_cf_func(nir_function *func) nir_metadata_require(old_impl, nir_metadata_dominance | nir_metadata_divergence); /* First, we temporarily get rid of SSA. This will make all our block - * motion way easier. + * motion way easier. Ask the pass to place reg writes directly in the + * immediate predecessors of the phis instead of trying to be clever. + * This will ensure that we never get a write to a uniform register from + * non-uniform control flow and makes our divergence reconstruction for + * phis more reliable. */ nir_foreach_block(block, old_impl) - nir_lower_phis_to_regs_block(block, false); + nir_lower_phis_to_regs_block(block, true); /* We create a whole new nir_function_impl and copy the contents over */ func->impl = NULL;