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] Speed up intersect_loc_chains (PR debug/41371)


Hi!

This patch speeds up a little bit var-tracking on PR41371 testcase:
time ./cc1plus -g -O2 bug90.cc -quiet
with a --enable-checking=release x86_64-linux gcc went down from:
real	4m52.484s
user	4m51.991s
sys	0m0.446s

to:

real	3m38.218s
user	3m37.641s
sys	0m0.383s

In x86_64-linux and i686-linux bootstraps + regtests
together intersect_loc_chains could avoid 72% of all the
find_loc_in_1pdv calls from that function.

Bootstrapped/regtested on x86_64-linux and i686-linux, no changes
in generated debuginfo in gcc/*.o and gcc/*/*.o (except for
gcc/var-tracking.o obviously and gcc/*-checksum.o).

Ok for trunk?

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.

--- gcc/var-tracking.c.jj	2010-05-21 11:46:31.000000000 +0200
+++ gcc/var-tracking.c	2010-05-25 11:11:21.000000000 +0200
@@ -2489,12 +2489,16 @@ find_loc_in_1pdv (rtx loc, variable var,
   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)
@@ -2589,6 +2593,33 @@ intersect_loc_chains (rtx val, location_
   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)


	Jakub


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