glsl/ir_variable_refcount: don't ralloc the hash table

Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36728>
This commit is contained in:
Marek Olšák 2025-08-11 01:54:47 -04:00 committed by Marge Bot
parent 44d9d4d06b
commit deac7cf1a2
3 changed files with 7 additions and 6 deletions

View file

@ -38,14 +38,14 @@
ir_variable_refcount_visitor::ir_variable_refcount_visitor()
{
this->linalloc = linear_context(ralloc_context(NULL));
this->ht = _mesa_pointer_hash_table_create(NULL);
_mesa_pointer_hash_table_init(&this->ht, NULL);
this->global = true;
}
ir_variable_refcount_visitor::~ir_variable_refcount_visitor()
{
ralloc_free(ralloc_parent_of_linear_context(this->linalloc));
_mesa_hash_table_destroy(this->ht, NULL);
_mesa_hash_table_fini(&this->ht, NULL);
}
// constructor
@ -63,13 +63,13 @@ ir_variable_refcount_visitor::get_variable_entry(ir_variable *var)
{
assert(var);
struct hash_entry *e = _mesa_hash_table_search(this->ht, var);
struct hash_entry *e = _mesa_hash_table_search(&this->ht, var);
if (e)
return (ir_variable_refcount_entry *)e->data;
ir_variable_refcount_entry *entry = new(linalloc) ir_variable_refcount_entry(var);
assert(entry->referenced_count == 0);
_mesa_hash_table_insert(this->ht, var, entry);
_mesa_hash_table_insert(&this->ht, var, entry);
return entry;
}

View file

@ -35,6 +35,7 @@
#include "ir.h"
#include "ir_visitor.h"
#include "compiler/glsl_types.h"
#include "util/hash_table.h"
struct assignment_entry {
ir_exec_node link;
@ -90,7 +91,7 @@ public:
/**
* Hash table mapping ir_variable to ir_variable_refcount_entry.
*/
struct hash_table *ht;
struct hash_table ht;
linear_ctx *linalloc;

View file

@ -50,7 +50,7 @@ do_dead_code(ir_exec_list *instructions)
v.run(instructions);
hash_table_foreach(v.ht, e) {
hash_table_foreach(&v.ht, e) {
ir_variable_refcount_entry *entry = (ir_variable_refcount_entry *)e->data;
/* Since each assignment is a reference, the refereneced count must be