summaryrefslogtreecommitdiffstats
path: root/src/compiler/nir
diff options
context:
space:
mode:
authorConnor Abbott <[email protected]>2019-10-22 17:50:07 +0200
committerConnor Abbott <[email protected]>2019-11-14 13:10:58 +0000
commitf9fd04aca15fd00889caa666ba38007268e67f5c (patch)
treecc8b38e7e436a28ee0da648231c68b238f47e8f6 /src/compiler/nir
parentf512965b0b3d70525424f100e534b8ac0a43a376 (diff)
nir: Fix non-determinism in lower_global_vars_to_local
Using a hash-table walk means that variables will get inserted in different orders on different runs. Just walk the list of globals instead, even if some of them can't be turned into locals. Reviewed-by: Kristian H. Kristensen <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/compiler/nir')
-rw-r--r--src/compiler/nir/nir_lower_global_vars_to_local.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/compiler/nir/nir_lower_global_vars_to_local.c b/src/compiler/nir/nir_lower_global_vars_to_local.c
index 4df87aba366..9efc511bcad 100644
--- a/src/compiler/nir/nir_lower_global_vars_to_local.c
+++ b/src/compiler/nir/nir_lower_global_vars_to_local.c
@@ -83,8 +83,11 @@ nir_lower_global_vars_to_local(nir_shader *shader)
}
}
- hash_table_foreach(var_func_table, entry) {
- nir_variable *var = (void *)entry->key;
+ nir_foreach_variable_safe(var, &shader->globals) {
+ struct hash_entry *entry = _mesa_hash_table_search(var_func_table, var);
+ if (!entry)
+ continue;
+
nir_function_impl *impl = entry->data;
assert(var->data.mode == nir_var_shader_temp);