Thomas Helland <[email protected]> writes: > Walking the whole hash table, inserting entries by hashing them first > is just a really bad idea. We can simply memcpy the whole thing. > --- > src/compiler/glsl/opt_copy_propagation.cpp | 13 ++++------ > .../glsl/opt_copy_propagation_elements.cpp | 29 > ++++++++-------------- > 2 files changed, 15 insertions(+), 27 deletions(-) > > diff --git a/src/compiler/glsl/opt_copy_propagation.cpp > b/src/compiler/glsl/opt_copy_propagation.cpp > index e904e6ede4..96667779da 100644 > --- a/src/compiler/glsl/opt_copy_propagation.cpp > +++ b/src/compiler/glsl/opt_copy_propagation.cpp > @@ -220,10 +220,7 @@ ir_copy_propagation_visitor::handle_if_block(exec_list > *instructions) > 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);
Remove creation of acp above
>
> visit_list_elements(this, instructions);
>
> @@ -271,10 +268,10 @@ ir_copy_propagation_visitor::handle_loop(ir_loop *ir,
> bool keep_acp)
> 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);
> }
Again, remove the old creation of the acp.
Other than that, these are:
Reviewed-by: Eric Anholt <[email protected]>
signature.asc
Description: PGP signature
_______________________________________________ mesa-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-dev
