egcs 1.1.1 extremely slow

Martin v. Loewis martin@mira.isdn.cs.tu-berlin.de
Sat Jan 23 03:36:00 GMT 1999


> Isn't there anything that can be done about it?

After some investigations, I did something about it. It turns out that
Koenig lookup uses ovl_member to determine whether a function has
already been found in regular lookup. In that context, comparing
functions with decls_match is overkill; plain identity is sufficient.

Below is a patch. It was generated for the development branch, but
applies to 1.1.1 as well. When run on i586-pc-linux-gnu with the 1.1.1
testsuite, it shows no failures compared to original 1.1.1. I'd like
to see this patch in the release branch as well.

With this patch, the testcase I'm using compiles in 3,0 seconds. As
reported earlier, egcs 1.1.1 needs 6,0 seconds, and egcs 1.0 needs 2,8
seconds. So egcs 1.1 is still slower, but only slightly so.

Martin

1999-01-23  Martin von Löwis  <loewis@informatik.hu-berlin.de>

	* tree.c (ovl_identity_member): New function.
	* cp-tree.h: Declare it.
	* decl2.c (add_function): Call it.	

Index: cp-tree.h
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/cp-tree.h,v
retrieving revision 1.190
diff -u -p -r1.190 cp-tree.h
--- cp-tree.h	1999/01/21 21:16:17	1.190
+++ cp-tree.h	1999/01/23 09:16:07
@@ -3270,6 +3270,7 @@ extern int bound_pmf_p				PROTO((tree));
 extern tree ovl_cons                            PROTO((tree, tree));
 extern tree scratch_ovl_cons                    PROTO((tree, tree));
 extern int ovl_member                           PROTO((tree, tree));
+extern int ovl_identity_member                  PROTO((tree, tree));
 extern tree build_overload                      PROTO((tree, tree));
 extern tree fnaddr_from_vtable_entry		PROTO((tree));
 extern tree function_arg_chain			PROTO((tree));
Index: decl2.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/decl2.c,v
retrieving revision 1.174
diff -u -p -r1.174 decl2.c
--- decl2.c	1999/01/21 21:16:20	1.174
+++ decl2.c	1999/01/23 09:16:12
@@ -4390,7 +4390,7 @@ add_function (k, fn)
      struct arg_lookup *k;
      tree fn;
 {
-  if (ovl_member (fn, k->functions))
+  if (ovl_identity_member (fn, k->functions))
     return 0;
   /* We must find only functions, or exactly one non-function. */
   if (k->functions && is_overloaded_fn (k->functions)
Index: tree.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/tree.c,v
retrieving revision 1.92
diff -u -p -r1.92 tree.c
--- tree.c	1999/01/21 21:16:22	1.92
+++ tree.c	1999/01/23 09:16:14
@@ -1412,6 +1412,23 @@ ovl_member (fn, ovl)
   return 0;
 }
 
+/* Like ovl_member, but checks identity instead of decls_match. */
+
+int
+ovl_identity_member (fn, ovl)
+     tree fn;
+     tree ovl;
+{
+  if (ovl == NULL_TREE)
+    return 0;
+  if (TREE_CODE (ovl) != OVERLOAD)
+    return ovl == fn;
+  for (; ovl; ovl = OVL_CHAIN (ovl))
+    if (OVL_FUNCTION (ovl) == fn)
+      return 1;
+  return 0;
+}
+
 int
 is_aggr_type_2 (t1, t2)
      tree t1, t2;




More information about the Gcc-patches mailing list