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]

Re: [PATCH, PR 43257] Mangle DECL_ASSEMBLER_NAME early in IPA-SRA


Am Wed 10 Mar 2010 10:56:24 AM CET schrieb Richard Guenther <rguenther@suse.de>:

On Tue, 9 Mar 2010, Martin Jambor wrote:

Hi,

the patch below makes IPA-SRA mangle the assembler name of a function
decl before changing its type to avoid potential conflicts with other
functions.

Bootstrapped and regression tested on x86_64-linux. OK for trunk?

Hm. Please look at tree.c:free_lang_data_in_cgraph - that seems to fixup some diagnostic issues. But on the whole thing I wonder if we shouldn't simply make sure that functions with a cgraph node have an assembler name set in cgraph_finalize_function (or cgraph_analyze_function if we want to delay it until after cgraph_finalize_compilation_unit)? Thus, replicate the if (need_assembler_name_p (t)) from tree.c:free_lang_data_in_cgraph in cgraph_analyze_function (and maybe similar in varpool_analyze_pending_decls).

Can you try doing just the cgraph part in cgraph_analyze_function?

Well, original implementation of cgraph computed ASSEMBLER_NAME for every
reachable node of callgraph (i.e. not only those seen by cgraph_analyze_function but also for nodes representing reachable external calls. This was later reverted by C++ folks claiming that it is important to delay this in order to save memory. With LTO we now again compute those names quite aggressively, so I would not have problem with returning that there, but perhaps we could try to gather some data on how much extra memory it uses?
With inlining we avoid a lot of those assembler names on the way to assembly on stuff like tramp3d, but this has no chance to cope well with LTO anyway and freeing fronend datas seems more win in general.


Honza

Honza?


Thanks,
Richard.

Thanks,

Martin


2010-03-09 Martin Jambor <mjambor@suse.cz>


	PR tree-optimization/43257
	* ipa-prop.c (ipa_modify_formal_parameters): Call
	set_decl_assembler_name if not already set.

* testsuite/g++.dg/torture/pr43257.C: New test.

Index: mine/gcc/ipa-prop.c
===================================================================
--- mine.orig/gcc/ipa-prop.c
+++ mine/gcc/ipa-prop.c
@@ -1497,6 +1497,9 @@ ipa_modify_formal_parameters (tree fndec
   if (!synth_parm_prefix)
     synth_parm_prefix = "SYNTH";

+  if (!DECL_ASSEMBLER_NAME_SET_P (fndecl))
+    lang_hooks.set_decl_assembler_name (fndecl);
+
   oparms = ipa_get_vector_of_formal_parms (fndecl);
   orig_type = TREE_TYPE (fndecl);
   old_arg_types = TYPE_ARG_TYPES (orig_type);
Index: mine/gcc/testsuite/g++.dg/torture/pr43257.C
===================================================================
--- /dev/null
+++ mine/gcc/testsuite/g++.dg/torture/pr43257.C
@@ -0,0 +1,30 @@
+/* { dg-do assemble } */
+
+class A {};
+class B {};
+
+static void *func (int n)
+{
+  void *p;
+  if (p == 0) throw ::A ();
+}
+
+static void *func (int n, B const &)
+{
+  try {
+      return func (n);
+  }
+  catch (::A const &) {
+  }
+  return func (n);
+}
+
+void *f1 (int n)
+{
+  return func (n, B());
+}
+
+void *f2 (int n)
+{
+  return func (n, B());
+}



--
Richard Guenther <rguenther@suse.de>
Novell / SUSE Labs
SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746 - GF: Markus Rex





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