summaryrefslogtreecommitdiffstats
path: root/src/glsl/nir/nir_live_variables.c
diff options
context:
space:
mode:
authorJose Fonseca <[email protected]>2015-02-26 16:37:48 +0000
committerJose Fonseca <[email protected]>2015-02-27 14:30:36 +0000
commitf320ecf218ab24ef4883f918a9007b2a6cfdac5e (patch)
tree2548b93631d89800ac4bd7172a45d04d5b8cebff /src/glsl/nir/nir_live_variables.c
parent84a1e3d61e6df449571e41426ec64b115fedc7c3 (diff)
nir: Use alloca instead of variable length arrays.
This is to enable the code to build with -Werror=vla in the short term, and enable the code to build with MSVC2013 soon after. Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/glsl/nir/nir_live_variables.c')
-rw-r--r--src/glsl/nir/nir_live_variables.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/glsl/nir/nir_live_variables.c b/src/glsl/nir/nir_live_variables.c
index 7402dc0877e..b57ca3a2780 100644
--- a/src/glsl/nir/nir_live_variables.c
+++ b/src/glsl/nir/nir_live_variables.c
@@ -26,6 +26,7 @@
#include "nir.h"
#include "nir_worklist.h"
+#include "c99_alloca.h"
/*
* Basic liveness analysis. This works only in SSA form.
@@ -130,8 +131,8 @@ static bool
propagate_across_edge(nir_block *pred, nir_block *succ,
struct live_variables_state *state)
{
- BITSET_WORD live[state->bitset_words];
- memcpy(live, succ->live_in, sizeof live);
+ BITSET_WORD *live = alloca(state->bitset_words * sizeof *live);
+ memcpy(live, succ->live_in, state->bitset_words * sizeof *live);
nir_foreach_instr(succ, instr) {
if (instr->type != nir_instr_type_phi)