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]

[lto] Clear out TYPE_BINFO


This patch from Rafael removes TYPE_BINFO in
pass_ipa_free_lang_specifics.  This currently will cause a
regression in that we cannot devirtualize method calls (PR
38178).

We will need to emit enough binfo information in the LTO output
to be able to do this in the future.  But for now, TYPE_BINFO
contains too much FE specific information that is not needed in
gimple.


Tested on x86_64.



2008-11-20  Rafael Espindola  <espindola@google.com>
	    Diego Novillo  <dnovillo@google.com>

	* tree.c (reset_type_lang_specific): Set TYPE_BINFO to
	NULL.

cp/ChangeLog.lto

	* cp-lang.c (LANG_HOOKS_FOLD_OBJ_TYPE_REF): Undefine.

testsuite/ChangeLog.lto:

	* g++.dg/lto/20081119_0.C: New.
	* g++.dg/lto/20081119_1.C: New.
	* g++.dg/opt/devirt1.C: Do not scan for the devirtualized
	call.

Index: tree.c
===================================================================
--- tree.c	(revision 142050)
+++ tree.c	(working copy)
@@ -3933,6 +3933,7 @@ reset_type_lang_specific (void **slot, v
 	TYPE_FIELDS (type) = NULL_TREE;
 
       TYPE_METHODS (type)  = NULL_TREE;
+      TYPE_BINFO (type)  = NULL_TREE;
     }
 
   if (TREE_CODE (type) == INTEGER_TYPE)
Index: testsuite/g++.dg/lto/20081119_0.C
===================================================================
--- testsuite/g++.dg/lto/20081119_0.C	(revision 0)
+++ testsuite/g++.dg/lto/20081119_0.C	(revision 0)
@@ -0,0 +1,24 @@
+class foo {
+ public:
+ foo () {}
+ virtual ~foo() {}
+ virtual void m() {}
+};
+
+template<typename t>
+class bar : public foo {
+ public:
+ bar () {}
+};
+
+void
+f1 (bar<int> *p)
+{
+ p->m();
+}
+
+int
+main ()
+{
+ return 0;
+}
Index: testsuite/g++.dg/lto/20081119_1.C
===================================================================
--- testsuite/g++.dg/lto/20081119_1.C	(revision 0)
+++ testsuite/g++.dg/lto/20081119_1.C	(revision 0)
@@ -0,0 +1,18 @@
+class foo {
+ public:
+ foo () {}
+ virtual ~foo() {}
+ virtual void m() {}
+};
+
+template<typename t>
+class bar : public foo {
+ public:
+ bar () {}
+};
+
+void
+f2 (bar<int> *p)
+{
+ p->m();
+}
Index: testsuite/g++.dg/opt/devirt1.C
===================================================================
--- testsuite/g++.dg/opt/devirt1.C	(revision 142050)
+++ testsuite/g++.dg/opt/devirt1.C	(working copy)
@@ -1,6 +1,7 @@
 // { dg-do compile }
 // { dg-options "-O" }
-// { dg-final { scan-assembler "xyzzy" } }
+// Do not scan for the devirtualized call for now (PR 38178)
+//  dg-final { scan-assembler "xyzzy" } 
 
 struct S { S(); virtual void xyzzy(); };
 inline void foo(S *s) { s->xyzzy(); }
Index: cp/cp-lang.c
===================================================================
--- cp/cp-lang.c	(revision 142050)
+++ cp/cp-lang.c	(working copy)
@@ -53,8 +53,12 @@ static enum classify_record cp_classify_
 #define LANG_HOOKS_DECL_PRINTABLE_NAME	cxx_printable_name
 #undef LANG_HOOKS_DWARF_NAME
 #define LANG_HOOKS_DWARF_NAME cxx_dwarf_name
-#undef LANG_HOOKS_FOLD_OBJ_TYPE_REF
-#define LANG_HOOKS_FOLD_OBJ_TYPE_REF cp_fold_obj_type_ref
+
+/* FIXME lto: disabled so we can clear TYPE_BINFO.
+   See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38178.  */
+/* #undef LANG_HOOKS_FOLD_OBJ_TYPE_REF */
+/* #define LANG_HOOKS_FOLD_OBJ_TYPE_REF cp_fold_obj_type_ref */
+
 #undef LANG_HOOKS_INIT_TS
 #define LANG_HOOKS_INIT_TS cp_init_ts
 


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