[Mesa-dev] [PATCH 2/2] glsl: Use hash table cloning in copy propagation

Emil Velikov emil.l.velikov at gmail.com
Mon Mar 12 18:53:33 UTC 2018


Hi Thomas,

If I were you I'd split out the introduction of clone_acp() into a
separate patch.
Regardless of that suggestions, there seems to be a bug in this patch.

On 12 March 2018 at 17:55, Thomas Helland <thomashelland90 at gmail.com> wrote:
> 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);
>
There's a _mesa_hash_table_create just above that should be removed.

HTH
Emil


More information about the mesa-dev mailing list