<div dir="ltr">Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Feb 20, 2019 at 12:30 AM Timothy Arceri <<a href="mailto:tarceri@itsqueeze.com">tarceri@itsqueeze.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Even in a very basic shader this reduces the time spent in<br>
nir_copy_prop() by ~17%.<br>
<br>
No shader-db changes for radeonsi NIR or i965.<br>
---<br>
 src/compiler/nir/nir_opt_copy_propagate.c | 41 +++--------------------<br>
 1 file changed, 5 insertions(+), 36 deletions(-)<br>
<br>
diff --git a/src/compiler/nir/nir_opt_copy_propagate.c b/src/compiler/nir/nir_opt_copy_propagate.c<br>
index 534f127c0d3..10b81c0a684 100644<br>
--- a/src/compiler/nir/nir_opt_copy_propagate.c<br>
+++ b/src/compiler/nir/nir_opt_copy_propagate.c<br>
@@ -34,6 +34,8 @@<br>
<br>
 static bool is_move(nir_alu_instr *instr)<br>
 {<br>
+   assert(instr->src[0].src.is_ssa);<br>
+<br>
    if (instr->op != nir_op_fmov &&<br>
        instr->op != nir_op_imov)<br>
       return false;<br>
@@ -46,9 +48,6 @@ static bool is_move(nir_alu_instr *instr)<br>
    if (instr->src[0].abs || instr->src[0].negate)<br>
       return false;<br>
<br>
-   if (!instr->src[0].src.is_ssa)<br>
-      return false;<br>
-<br>
    return true;<br>
<br>
 }<br>
@@ -56,8 +55,7 @@ static bool is_move(nir_alu_instr *instr)<br>
 static bool is_vec(nir_alu_instr *instr)<br>
 {<br>
    for (unsigned i = 0; i < nir_op_infos[instr->op].num_inputs; i++) {<br>
-      if (!instr->src[i].src.is_ssa)<br>
-         return false;<br>
+      assert(instr->src[i].src.is_ssa);<br>
<br>
       /* we handle modifiers in a separate pass */<br>
       if (instr->src[i].abs || instr->src[i].negate)<br>
@@ -102,11 +100,7 @@ static bool<br>
 copy_prop_src(nir_src *src, nir_instr *parent_instr, nir_if *parent_if,<br>
               unsigned num_components)<br>
 {<br>
-   if (!src->is_ssa) {<br>
-      if (src->reg.indirect)<br>
-         return copy_prop_src(src->reg.indirect, parent_instr, parent_if, 1);<br>
-      return false;<br>
-   }<br>
+   assert(src->is_ssa);<br>
<br>
    nir_instr *src_instr = src->ssa->parent_instr;<br>
    nir_ssa_def *copy_def;<br>
@@ -137,12 +131,7 @@ static bool<br>
 copy_prop_alu_src(nir_alu_instr *parent_alu_instr, unsigned index)<br>
 {<br>
    nir_alu_src *src = &parent_alu_instr->src[index];<br>
-   if (!src->src.is_ssa) {<br>
-      if (src->src.reg.indirect)<br>
-         return copy_prop_src(src->src.reg.indirect, &parent_alu_instr->instr,<br>
-                              NULL, 1);<br>
-      return false;<br>
-   }<br>
+   assert(src->src.is_ssa);<br>
<br>
    nir_instr *src_instr =  src->src.ssa->parent_instr;<br>
    if (src_instr->type != nir_instr_type_alu)<br>
@@ -187,15 +176,6 @@ copy_prop_alu_src(nir_alu_instr *parent_alu_instr, unsigned index)<br>
    return true;<br>
 }<br>
<br>
-static bool<br>
-copy_prop_dest(nir_dest *dest, nir_instr *instr)<br>
-{<br>
-   if (!dest->is_ssa && dest->reg.indirect)<br>
-      return copy_prop_src(dest->reg.indirect, instr, NULL, 1);<br>
-<br>
-   return false;<br>
-}<br>
-<br>
 static bool<br>
 copy_prop_instr(nir_instr *instr)<br>
 {<br>
@@ -208,9 +188,6 @@ copy_prop_instr(nir_instr *instr)<br>
          while (copy_prop_alu_src(alu_instr, i))<br>
             progress = true;<br>
<br>
-      while (copy_prop_dest(&alu_instr->dest.dest, instr))<br>
-         progress = true;<br>
-<br>
       return progress;<br>
    }<br>
<br>
@@ -241,9 +218,6 @@ copy_prop_instr(nir_instr *instr)<br>
             progress = true;<br>
       }<br>
<br>
-      while (copy_prop_dest(&tex->dest, instr))<br>
-         progress = true;<br>
-<br>
       return progress;<br>
    }<br>
<br>
@@ -257,11 +231,6 @@ copy_prop_instr(nir_instr *instr)<br>
             progress = true;<br>
       }<br>
<br>
-      if (nir_intrinsic_infos[intrin->intrinsic].has_dest) {<br>
-         while (copy_prop_dest(&intrin->dest, instr))<br>
-            progress = true;<br>
-      }<br>
-<br>
       return progress;<br>
    }<br>
<br>
-- <br>
2.20.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></blockquote></div>