[Mesa-dev] [PATCH 5/7] glsl: Prehash in constant propagation

Thomas Helland thomashelland90 at gmail.com
Thu Feb 2 20:57:31 UTC 2017


---
 src/compiler/glsl/opt_constant_propagation.cpp | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/compiler/glsl/opt_constant_propagation.cpp b/src/compiler/glsl/opt_constant_propagation.cpp
index 4039512097..553de9c803 100644
--- a/src/compiler/glsl/opt_constant_propagation.cpp
+++ b/src/compiler/glsl/opt_constant_propagation.cpp
@@ -454,15 +454,17 @@ ir_constant_propagation_visitor::kill(ir_variable *var, unsigned write_mask)
    /* Add this writemask of the variable to the hash table of killed
     * variables in this block.
     */
-   hash_entry *kill_hash_entry = _mesa_hash_table_search(this->kills, var);
+   uint32_t hash = this->kills->key_hash_function(var);
+   hash_entry *kill_hash_entry =
+         _mesa_hash_table_search_pre_hashed(this->kills, hash, var);
    if (kill_hash_entry) {
       kill_entry *entry = (kill_entry *) kill_hash_entry->data;
       entry->write_mask |= write_mask;
       return;
    }
    /* Not already in the hash table.  Make new entry. */
-   _mesa_hash_table_insert(this->kills, var,
-                           new(this->lin_ctx) kill_entry(var, write_mask));
+   _mesa_hash_table_insert_pre_hashed(this->kills, hash, var,
+         new(this->lin_ctx) kill_entry(var, write_mask));
 }
 
 /**
-- 
2.11.0



More information about the mesa-dev mailing list