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 <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
entry->mem_ctx = ralloc_parent(entry->var);
for (unsigned int i = 0; i < entry->var->type->vector_elements; i++) {
- const char *name = ralloc_asprintf(mem_ctx, "%s_%c",
- entry->var->name,
- "xyzw"[i]);
+ char *const name = ir_variable::temporaries_allocate_names
+ ? ralloc_asprintf(mem_ctx, "%s_%c",
+ entry->var->name,
+ "xyzw"[i])
+ : NULL;
entry->components[i] = new(entry->mem_ctx) ir_variable(type, name,
ir_var_temporary);
+
+ ralloc_free(name);
+
entry->var->insert_before(entry->components[i]);
}