<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Feb 2, 2017 at 12:57 PM, Thomas Helland <span dir="ltr"><<a href="mailto:thomashelland90@gmail.com" target="_blank">thomashelland90@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This should prove benefitial in the common case of inserting<br>
and not rewriting anything.<br>
---<br>
 src/compiler/nir/nir_instr_<wbr>set.c | 8 ++++++--<br>
 1 file changed, 6 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/src/compiler/nir/nir_instr_<wbr>set.c b/src/compiler/nir/nir_instr_<wbr>set.c<br>
index 9cb9ed43e8..4c45d051f8 100644<br>
--- a/src/compiler/nir/nir_instr_<wbr>set.c<br>
+++ b/src/compiler/nir/nir_instr_<wbr>set.c<br>
@@ -508,7 +508,11 @@ nir_instr_set_add_or_rewrite(<wbr>struct set *instr_set, nir_instr *instr)<br>
    if (!instr_can_rewrite(instr))<br>
       return false;<br>
<br>
-   struct set_entry *entry = _mesa_set_search(instr_set, instr);<br>
+   uint32_t hash = instr_set->key_hash_function(<wbr>instr);<br></blockquote><div><br></div><div>We know what the hash function is (it's hash_instr).  There's no reason why we need to go through function pointer.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+<br>
+   struct set_entry *entry =<br>
+      _mesa_set_search_pre_hashed(<wbr>instr_set, hash, instr);<br>
+<br>
    if (entry) {<br>
       nir_ssa_def *def = nir_instr_get_dest_ssa_def(<wbr>instr);<br>
       nir_instr *match = (nir_instr *) entry->key;<br>
@@ -526,7 +530,7 @@ nir_instr_set_add_or_rewrite(<wbr>struct set *instr_set, nir_instr *instr)<br>
       return true;<br>
    }<br>
<br>
-   _mesa_set_add(instr_set, instr);<br>
+   _mesa_set_add_pre_hashed(<wbr>instr_set, hash, instr);<br>
    return false;<br>
 }<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
2.11.0<br>
<br>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">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/<wbr>mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div></div>