<div dir="ltr"><div>Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>></div><div><br></div><div>Thanks for figuring this out.  This probably explains some of the hurt I was seeing with my series as well.</div><div><br></div><div>--Jason<br></div></div><br><div class="gmail_quote"><div dir="ltr">On Tue, Oct 30, 2018 at 9:17 PM 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">From: Timothy Arceri <tarceri@localhost.localdomain><br>
<br>
We need to update the cursor before we check if the alu use is<br>
dominated by the if condition. Previously we were checking if<br>
the current location of the alu instruction was dominated by<br>
the if condition which would miss some optimisation opportunities.<br>
<br>
Fixes: a3b4cb34589e ("nir/opt_if: Rework condition propagation")<br>
---<br>
 src/compiler/nir/nir_opt_if.c | 3 +--<br>
 1 file changed, 1 insertion(+), 2 deletions(-)<br>
<br>
diff --git a/src/compiler/nir/nir_opt_if.c b/src/compiler/nir/nir_opt_if.c<br>
index 1f2e1f21130..1fe95e53766 100644<br>
--- a/src/compiler/nir/nir_opt_if.c<br>
+++ b/src/compiler/nir/nir_opt_if.c<br>
@@ -444,11 +444,10 @@ propagate_condition_eval(nir_builder *b, nir_if *nif, nir_src *use_src,<br>
                          bool is_if_condition)<br>
 {<br>
    bool bool_value;<br>
+   b->cursor = nir_before_src(alu_use, is_if_condition);<br>
    if (!evaluate_if_condition(nif, b->cursor, &bool_value))<br>
       return false;<br>
<br>
-   b->cursor = nir_before_src(alu_use, is_if_condition);<br>
-<br>
    nir_ssa_def *def[2] = {0};<br>
    for (unsigned i = 0; i < nir_op_infos[alu->op].num_inputs; i++) {<br>
       if (alu->src[i].src.ssa == use_src->ssa) {<br>
-- <br>
2.17.2<br>
<br>
</blockquote></div>