i965/fs: Don't make a name for a vector splitting temporary
authorIan Romanick <ian.d.romanick@intel.com>
Sat, 24 May 2014 03:03:31 +0000 (20:03 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Tue, 30 Sep 2014 20:34:43 +0000 (13:34 -0700)
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>
src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp

index 422d801b568362155adb195ba06a04d1aee77432..03e5fdbef2cfdf0ada678c287b100a6ca20a6652 100644 (file)
@@ -363,12 +363,17 @@ brw_do_vector_splitting(exec_list *instructions)
       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]);
       }