[Mesa-dev] [PATCH 1/2] glsl: Don't rehash the values when copying to new table

Thomas Helland thomashelland90 at gmail.com
Thu Dec 29 23:49:06 UTC 2016


Really, we should have some kind of function for copying the whole table,
but this will work for now.
---
 src/compiler/glsl/opt_copy_propagation.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/compiler/glsl/opt_copy_propagation.cpp b/src/compiler/glsl/opt_copy_propagation.cpp
index 247c498..e9f82e0 100644
--- a/src/compiler/glsl/opt_copy_propagation.cpp
+++ b/src/compiler/glsl/opt_copy_propagation.cpp
@@ -210,7 +210,8 @@ ir_copy_propagation_visitor::handle_if_block(exec_list *instructions)
    /* Populate the initial acp with a copy of the original */
    struct hash_entry *entry;
    hash_table_foreach(orig_acp, entry) {
-      _mesa_hash_table_insert(acp, entry->key, entry->data);
+      _mesa_hash_table_insert_pre_hashed(acp, entry->hash,
+                                         entry->key, entry->data);
    }
 
    visit_list_elements(this, instructions);
@@ -259,7 +260,8 @@ ir_copy_propagation_visitor::handle_loop(ir_loop *ir, bool keep_acp)
    if (keep_acp) {
       struct hash_entry *entry;
       hash_table_foreach(orig_acp, entry) {
-         _mesa_hash_table_insert(acp, entry->key, entry->data);
+         _mesa_hash_table_insert_pre_hashed(acp, entry->hash,
+                                            entry->key, entry->data);
       }
    }
 
-- 
2.9.3



More information about the mesa-dev mailing list