Mesa (master): vc4: Fix use of undefined values since the ralloc zeroing changes.
Eric Anholt
anholt at kemper.freedesktop.org
Fri Nov 4 01:43:18 UTC 2016
Module: Mesa
Branch: master
Commit: bedb99608735aaa260eba0144ca6d46dbe43be55
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=bedb99608735aaa260eba0144ca6d46dbe43be55
Author: Eric Anholt <eric at anholt.net>
Date: Wed Nov 2 13:51:10 2016 -0700
vc4: Fix use of undefined values since the ralloc zeroing changes.
reralloc() no longer zeroes the new contents, so switch to using
rzalloc_array() instead.
---
src/gallium/drivers/vc4/vc4_qir_live_variables.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/src/gallium/drivers/vc4/vc4_qir_live_variables.c b/src/gallium/drivers/vc4/vc4_qir_live_variables.c
index beefb0d..dc058f5 100644
--- a/src/gallium/drivers/vc4/vc4_qir_live_variables.c
+++ b/src/gallium/drivers/vc4/vc4_qir_live_variables.c
@@ -301,8 +301,13 @@ qir_calculate_live_intervals(struct vc4_compile *c)
{
int bitset_words = BITSET_WORDS(c->num_temps);
- c->temp_start = reralloc(c, c->temp_start, int, c->num_temps);
- c->temp_end = reralloc(c, c->temp_end, int, c->num_temps);
+ /* If we called this function more than once, then we should be
+ * freeing the previous arrays.
+ */
+ assert(!c->temp_start);
+
+ c->temp_start = rzalloc_array(c, int, c->num_temps);
+ c->temp_end = rzalloc_array(c, int, c->num_temps);
for (int i = 0; i < c->num_temps; i++) {
c->temp_start[i] = MAX_INSTRUCTION;
@@ -310,10 +315,10 @@ qir_calculate_live_intervals(struct vc4_compile *c)
}
qir_for_each_block(block, c) {
- block->def = reralloc(c, block->def, BITSET_WORD, bitset_words);
- block->use = reralloc(c, block->use, BITSET_WORD, bitset_words);
- block->live_in = reralloc(c, block->live_in, BITSET_WORD, bitset_words);
- block->live_out = reralloc(c, block->live_out, BITSET_WORD, bitset_words);
+ block->def = rzalloc_array(c, BITSET_WORD, bitset_words);
+ block->use = rzalloc_array(c, BITSET_WORD, bitset_words);
+ block->live_in = rzalloc_array(c, BITSET_WORD, bitset_words);
+ block->live_out = rzalloc_array(c, BITSET_WORD, bitset_words);
}
qir_setup_def_use(c);
More information about the mesa-commit
mailing list