diff options
author | Thomas Helland <[email protected]> | 2017-01-09 23:14:46 +0100 |
---|---|---|
committer | Thomas Helland <[email protected]> | 2018-03-14 19:52:02 +0100 |
commit | 5f129c05e698157c4481cd1e80a4a1b2f43ef96c (patch) | |
tree | 7197260e4bb59d477be2d1f9e006081832b3508a /src/compiler/glsl/opt_copy_propagation.cpp | |
parent | 6baaf4291b7ee83a50038a215412ab1de75b0f32 (diff) |
glsl: Use hash table cloning in copy propagation
Walking the whole hash table, inserting entries by hashing them first
is just a really bad idea. We can simply memcpy the whole thing.
V2: Remove leftover creation of acp in two places
Reviewed-by: Eric Anholt <[email protected]>
Reviewed-by: Emil Velikov <[email protected]>
Diffstat (limited to 'src/compiler/glsl/opt_copy_propagation.cpp')
-rw-r--r-- | src/compiler/glsl/opt_copy_propagation.cpp | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/src/compiler/glsl/opt_copy_propagation.cpp b/src/compiler/glsl/opt_copy_propagation.cpp index e904e6ede4a..6220aa86da9 100644 --- a/src/compiler/glsl/opt_copy_propagation.cpp +++ b/src/compiler/glsl/opt_copy_propagation.cpp @@ -213,17 +213,12 @@ ir_copy_propagation_visitor::handle_if_block(exec_list *instructions) set *orig_kills = this->kills; bool orig_killed_all = this->killed_all; - acp = _mesa_hash_table_create(NULL, _mesa_hash_pointer, - _mesa_key_pointer_equal); kills = _mesa_set_create(NULL, _mesa_hash_pointer, _mesa_key_pointer_equal); this->killed_all = false; /* 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); - } + acp = _mesa_hash_table_clone(orig_acp, NULL); visit_list_elements(this, instructions); @@ -264,17 +259,15 @@ ir_copy_propagation_visitor::handle_loop(ir_loop *ir, bool keep_acp) set *orig_kills = this->kills; bool orig_killed_all = this->killed_all; - acp = _mesa_hash_table_create(NULL, _mesa_hash_pointer, - _mesa_key_pointer_equal); kills = _mesa_set_create(NULL, _mesa_hash_pointer, _mesa_key_pointer_equal); this->killed_all = false; if (keep_acp) { - struct hash_entry *entry; - hash_table_foreach(orig_acp, entry) { - _mesa_hash_table_insert(acp, entry->key, entry->data); - } + acp = _mesa_hash_table_clone(orig_acp, NULL); + } else { + acp = _mesa_hash_table_create(NULL, _mesa_hash_pointer, + _mesa_key_pointer_equal); } visit_list_elements(this, &ir->body_instructions); |