re PR debug/41371 (var-tracking is slow and memory hungry)
authorJakub Jelinek <jakub@redhat.com>
Tue, 25 May 2010 16:27:03 +0000 (18:27 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 25 May 2010 16:27:03 +0000 (18:27 +0200)
PR debug/41371
* var-tracking.c (find_loc_in_1pdv): Guard asserts with
ENABLE_CHECKING.
(intersect_loc_chains): Walk the s2var's loc_chain together
with s1node chain as long as the locations are equal, don't
call find_loc_in_1pdv in that case.

From-SVN: r159829

gcc/ChangeLog
gcc/var-tracking.c

index 371bba7..e109180 100644 (file)
@@ -1,5 +1,12 @@
 2010-05-25  Jakub Jelinek  <jakub@redhat.com>
 
+       PR debug/41371
+       * var-tracking.c (find_loc_in_1pdv): Guard asserts with
+       ENABLE_CHECKING.
+       (intersect_loc_chains): Walk the s2var's loc_chain together
+       with s1node chain as long as the locations are equal, don't
+       call find_loc_in_1pdv in that case.
+
        PR debug/42801
        * tree-inline.c (remap_decls): Remap DECL_VALUE_EXPR here...
        (copy_bind_expr): ... instead of here.
index b585393..7548d6b 100644 (file)
@@ -2490,12 +2490,16 @@ find_loc_in_1pdv (rtx loc, variable var, htab_t vars)
   if (!var)
     return NULL;
 
+#ifdef ENABLE_CHECKING
   gcc_assert (dv_onepart_p (var->dv));
+#endif
 
   if (!var->n_var_parts)
     return NULL;
 
+#ifdef ENABLE_CHECKING
   gcc_assert (var->var_part[0].offset == 0);
+#endif
 
   loc_code = GET_CODE (loc);
   for (node = var->var_part[0].loc_chain; node; node = node->next)
@@ -2590,6 +2594,33 @@ intersect_loc_chains (rtx val, location_chain *dest, struct dfset_merge *dsm,
   dataflow_set *s2set = dsm->src;
   location_chain found;
 
+  if (s2var)
+    {
+      location_chain s2node;
+
+#ifdef ENABLE_CHECKING
+      gcc_assert (dv_onepart_p (s2var->dv));
+#endif
+
+      if (s2var->n_var_parts)
+       {
+#ifdef ENABLE_CHECKING
+         gcc_assert (s2var->var_part[0].offset == 0);
+#endif
+         s2node = s2var->var_part[0].loc_chain;
+
+         for (; s1node && s2node;
+              s1node = s1node->next, s2node = s2node->next)
+           if (s1node->loc != s2node->loc)
+             break;
+           else if (s1node->loc == val)
+             continue;
+           else
+             insert_into_intersection (dest, s1node->loc,
+                                       MIN (s1node->init, s2node->init));
+       }
+    }
+
   for (; s1node; s1node = s1node->next)
     {
       if (s1node->loc == val)