diff options
author | Ian Romanick <[email protected]> | 2014-07-08 19:04:52 -0700 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2014-09-30 13:34:43 -0700 |
commit | 0b47252999e8a220a1478ffdcf952f12e843186a (patch) | |
tree | 0abd1a3d8b0db0e4db1c14f4ad6c386e38b6ed8d /src/glsl/ast_function.cpp | |
parent | c87d09d7f09fe2e734e97e72baabd7c54f7614a9 (diff) |
glsl: Don't make a name for the function return variable
If the name is just going to get dropped, don't bother making it. If
the name is made, release it sooner (rather than later).
No change Valgrind massif results for a trimmed apitrace of dota2.
Signed-off-by: Ian Romanick <[email protected]>
Reviewed-by: Matt Turner <[email protected]>
Diffstat (limited to 'src/glsl/ast_function.cpp')
-rw-r--r-- | src/glsl/ast_function.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp index 7130d616282..cbff9d8b452 100644 --- a/src/glsl/ast_function.cpp +++ b/src/glsl/ast_function.cpp @@ -408,14 +408,17 @@ generate_call(exec_list *instructions, ir_function_signature *sig, ir_dereference_variable *deref = NULL; if (!sig->return_type->is_void()) { /* Create a new temporary to hold the return value. */ + char *const name = ir_variable::temporaries_allocate_names + ? ralloc_asprintf(ctx, "%s_retval", sig->function_name()) + : NULL; + ir_variable *var; - var = new(ctx) ir_variable(sig->return_type, - ralloc_asprintf(ctx, "%s_retval", - sig->function_name()), - ir_var_temporary); + var = new(ctx) ir_variable(sig->return_type, name, ir_var_temporary); instructions->push_tail(var); + ralloc_free(name); + deref = new(ctx) ir_dereference_variable(var); } ir_call *call = new(ctx) ir_call(sig, deref, actual_parameters); |