Commit 1546b99e authored by Timothy Arceri's avatar Timothy Arceri

nir/opt_loop_unroll: Remove unneeded phis if we make progress

Now that SSA values can be derefs and they have special rules, we have
to be a bit more careful about our LCSSA phis.  In particular, we need
to clean up in case LCSSA ended up creating a phi node for a deref.
This avoids validation issues with some CTS tests with the new patch,
but its possible this we could also see the same problem with the
existing unrolling passes.
parent d344da10
......@@ -575,9 +575,17 @@ nir_opt_loop_unroll_impl(nir_function_impl *impl,
&has_nested_loop);
}
if (progress)
if (progress) {
nir_lower_regs_to_ssa_impl(impl);
/* Calling nir_convert_loop_to_lcssa() adds extra phi nodes which may
* not be valid if they're used for something such as a deref.
* Remove any unneeded phis.
*/
nir_copy_prop(impl->function->shader);
nir_opt_remove_phis_impl(impl);
}
return progress;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment