Mesa (master): v3d: Fix temporary leaks of temp_registers and when spilling.
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Mar 5 20:59:01 UTC 2019
Module: Mesa
Branch: master
Commit: 060979a380be0a6149e3e875ee24fdb1e7872821
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=060979a380be0a6149e3e875ee24fdb1e7872821
Author: Eric Anholt <eric at anholt.net>
Date: Tue Feb 26 10:46:36 2019 -0800
v3d: Fix temporary leaks of temp_registers and when spilling.
On each iteration of successfully spilling a reg, we'd allocate another
copy of temp_registers, and when decrementing thread conut we'd allocate
another copy of the graph. These all got cleaned up on freeing the
compile.
---
src/broadcom/compiler/vir_register_allocate.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/src/broadcom/compiler/vir_register_allocate.c b/src/broadcom/compiler/vir_register_allocate.c
index 91cce71e0ac..ae71e502494 100644
--- a/src/broadcom/compiler/vir_register_allocate.c
+++ b/src/broadcom/compiler/vir_register_allocate.c
@@ -394,8 +394,6 @@ v3d_register_allocate(struct v3d_compile *c, bool *spilled)
struct node_to_temp_map map[c->num_temps];
uint32_t temp_to_node[c->num_temps];
uint8_t class_bits[c->num_temps];
- struct qpu_reg *temp_registers = calloc(c->num_temps,
- sizeof(*temp_registers));
int acc_nodes[ACC_COUNT];
struct v3d_ra_select_callback_data callback_data = {
.next_acc = 0,
@@ -594,18 +592,19 @@ v3d_register_allocate(struct v3d_compile *c, bool *spilled)
if (node != -1) {
v3d_spill_reg(c, map[node].temp);
- ralloc_free(g);
/* Ask the outer loop to call back in. */
*spilled = true;
- return NULL;
}
}
- free(temp_registers);
+ ralloc_free(g);
return NULL;
}
+ struct qpu_reg *temp_registers = calloc(c->num_temps,
+ sizeof(*temp_registers));
+
for (uint32_t i = 0; i < c->num_temps; i++) {
int ra_reg = ra_get_node_reg(g, temp_to_node[i]);
if (ra_reg < PHYS_INDEX) {
More information about the mesa-commit
mailing list