diff options
author | Eric Anholt <[email protected]> | 2012-05-08 13:40:44 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2012-05-14 16:51:00 -0700 |
commit | f7a71e2570053205eb603aa04b8c52d4f54d8e4c (patch) | |
tree | 6275443c6d0ab980766a591ae4bbfd078bf595eb /src/mesa/drivers | |
parent | 206eca631b596154e8a9bf6a2d0de9fdb644b3cc (diff) |
i965/fs: When doing no work for live interval calculation, do no allocation.
When I had a bug causing the backend to never finish optimizing, it
also sent me deep into swap. This avoids extra memory allocation per
trip through optimization, and thus may reduce the peak memory
allocation of the driver even in the success case.
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs_live_variables.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs_live_variables.cpp b/src/mesa/drivers/dri/i965/brw_fs_live_variables.cpp index c6f0fbc009f..c7ee582c283 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_live_variables.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_live_variables.cpp @@ -163,12 +163,17 @@ void fs_visitor::calculate_live_intervals() { int num_vars = this->virtual_grf_next; - int *def = ralloc_array(mem_ctx, int, num_vars); - int *use = ralloc_array(mem_ctx, int, num_vars); if (this->live_intervals_valid) return; + int *def = ralloc_array(mem_ctx, int, num_vars); + int *use = ralloc_array(mem_ctx, int, num_vars); + ralloc_free(this->virtual_grf_def); + ralloc_free(this->virtual_grf_use); + this->virtual_grf_def = def; + this->virtual_grf_use = use; + for (int i = 0; i < num_vars; i++) { def[i] = MAX_INSTRUCTION; use[i] = -1; @@ -215,11 +220,6 @@ fs_visitor::calculate_live_intervals() } } - ralloc_free(this->virtual_grf_def); - ralloc_free(this->virtual_grf_use); - this->virtual_grf_def = def; - this->virtual_grf_use = use; - this->live_intervals_valid = true; } |