<div dir="ltr"><div>I'm not a huge fan of calling copy-prop here but I also don't see an easy way around it.</div><div><br></div><div>Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br></div></div><br><div class="gmail_quote"><div dir="ltr">On Mon, Aug 27, 2018 at 4:09 AM Timothy Arceri <<a href="mailto:tarceri@itsqueeze.com">tarceri@itsqueeze.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Now that SSA values can be derefs and they have special rules, we have<br>
to be a bit more careful about our LCSSA phis. In particular, we need<br>
to clean up in case LCSSA ended up creating a phi node for a deref.<br>
This avoids validation issues with some CTS tests with the following<br>
patch, but its possible this we could also see the same problem with<br>
the existing unrolling passes.<br>
---<br>
src/compiler/nir/nir_opt_loop_unroll.c | 10 +++++++++-<br>
1 file changed, 9 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/src/compiler/nir/nir_opt_loop_unroll.c b/src/compiler/nir/nir_opt_loop_unroll.c<br>
index a1ad0e59814..e0e0b754716 100644<br>
--- a/src/compiler/nir/nir_opt_loop_unroll.c<br>
+++ b/src/compiler/nir/nir_opt_loop_unroll.c<br>
@@ -575,9 +575,17 @@ nir_opt_loop_unroll_impl(nir_function_impl *impl,<br>
&has_nested_loop);<br>
}<br>
<br>
- if (progress)<br>
+ if (progress) {<br>
nir_lower_regs_to_ssa_impl(impl);<br>
<br>
+ /* Calling nir_convert_loop_to_lcssa() adds extra phi nodes which may<br>
+ * not be valid if they're used for something such as a deref.<br>
+ * Remove any unneeded phis.<br>
+ */<br>
+ nir_copy_prop(impl->function->shader);<br>
+ nir_opt_remove_phis_impl(impl);<br>
+ }<br>
+<br>
return progress;<br>
}<br>
<br>
-- <br>
2.17.1<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</blockquote></div>