This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] Fix PR debug/33868, gross memory usage in var-tracking


Hi,

someone seems to have inserted another if between an if and it's dependend 
break statement, without also adding the now necessary  { }.  This was 
harmless and just meant that variable infos where unnecessarily unshared 
leading to memory use of about 3.8 GB (!) on x86_64.  Now it merely uses 
about 600 MB, which is fine enough for this abysmal testcase.

On the process of debugging this I also added printing of DECL_UID to the 
dump file, so the several thousand different decls with the same name 
could be recognized as different.  Seems sensible on it's own for the next 
one looking at such a thing, so I've left it in.

Regstrapping on x86_64 in progress, okay if that passes?  I won't include 
the testcase, though.


Ciao,
Michael.
	PR debug/33868
	* var-tracking.c (variable_union): Don't break after one loop iteration
	but only when a difference is found.
	(dump_variable): Also print DECL_UID.

Index: gcc/var-tracking.c
===================================================================
--- gcc/var-tracking.c	(revision 129580)
+++ gcc/var-tracking.c	(working copy)
@@ -1221,9 +1221,11 @@ variable_union (void **slot, void *data)
 			 && REG_P (node->loc)
 			 && REGNO (node2->loc) == REGNO (node->loc))
 			|| rtx_equal_p (node2->loc, node->loc)))
-		    if (node2->init < node->init)
-		      node2->init = node->init;
-		    break;
+		    {
+		      if (node2->init < node->init)
+		        node2->init = node->init;
+		      break;
+		    }
 		}
 	      if (node || node2)
 		dst = unshare_variable (set, dst, VAR_INIT_STATUS_UNKNOWN);
@@ -2209,8 +2211,9 @@ dump_variable (void **slot, void *data A
   int i;
   location_chain node;
 
-  fprintf (dump_file, "  name: %s\n",
-	   IDENTIFIER_POINTER (DECL_NAME (var->decl)));
+  fprintf (dump_file, "  name: %s (%u)\n",
+	   IDENTIFIER_POINTER (DECL_NAME (var->decl)),
+	   DECL_UID (var->decl));
   for (i = 0; i < var->n_var_parts; i++)
     {
       fprintf (dump_file, "    offset %ld\n",


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]