aboutsummaryrefslogtreecommitdiffstats
path: root/src/compiler/nir/nir_lower_regs_to_ssa.c
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2019-07-22 00:51:24 -0500
committerJason Ekstrand <[email protected]>2019-07-22 16:17:18 -0500
commit5c5f11d1dd3b52e80483f132236c690cbbc3ea0b (patch)
tree4c553ebc8481c73372b0fae746877687ccf30e8d /src/compiler/nir/nir_lower_regs_to_ssa.c
parentfa63fad3332309afa14fea68c87cf6aa138fb45c (diff)
nir: Remove a bunch of large stack arrays
Reviewed-by: Lionel Landwerlin <[email protected]> Reviewed-by: Matt Turner <[email protected]>
Diffstat (limited to 'src/compiler/nir/nir_lower_regs_to_ssa.c')
-rw-r--r--src/compiler/nir/nir_lower_regs_to_ssa.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/compiler/nir/nir_lower_regs_to_ssa.c b/src/compiler/nir/nir_lower_regs_to_ssa.c
index 76ed1287379..b755d1df99e 100644
--- a/src/compiler/nir/nir_lower_regs_to_ssa.c
+++ b/src/compiler/nir/nir_lower_regs_to_ssa.c
@@ -220,14 +220,16 @@ nir_lower_regs_to_ssa_impl(nir_function_impl *impl)
nir_metadata_dominance);
nir_index_local_regs(impl);
+ void *dead_ctx = ralloc_context(NULL);
struct regs_to_ssa_state state;
state.shader = impl->function->shader;
- state.values = malloc(impl->reg_alloc * sizeof(*state.values));
+ state.values = ralloc_array(dead_ctx, struct nir_phi_builder_value *,
+ impl->reg_alloc);
struct nir_phi_builder *phi_build = nir_phi_builder_create(impl);
const unsigned block_set_words = BITSET_WORDS(impl->num_blocks);
- NIR_VLA(BITSET_WORD, defs, block_set_words);
+ BITSET_WORD *defs = ralloc_array(dead_ctx, BITSET_WORD, block_set_words);
nir_foreach_register(reg, &impl->registers) {
if (reg->num_array_elems != 0) {
@@ -305,7 +307,7 @@ nir_lower_regs_to_ssa_impl(nir_function_impl *impl)
}
}
- free(state.values);
+ ralloc_free(dead_ctx);
nir_metadata_preserve(impl, nir_metadata_block_index |
nir_metadata_dominance);