This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Remove non-var-decls from blocks in free_lang_data
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: gcc-patches at gcc dot gnu dot org, rguenther at suse dot de
- Date: Thu, 14 Jun 2018 13:41:24 +0200
- Subject: Remove non-var-decls from blocks in free_lang_data
Hi,
this patch removes TYPE_DECLs and CONST_DECLs from block trees for LTO.
With early debug we have no good use for it anymore.
ltobootstrapped/regtested x86-64-linux, OK?
Honza
* tree.c (find_decls_types_r): Remove all non-VAR_DECLs from
blocks.
* g++.dg/lto/pr84805_0.C: Update template.
* g++.dg/lto/pr84805_1.C: Update template.
Index: tree.c
===================================================================
--- tree.c (revision 261546)
+++ tree.c (working copy)
@@ -5556,10 +5556,22 @@ find_decls_types_r (tree *tp, int *ws, v
}
else if (TREE_CODE (t) == BLOCK)
{
- tree tem;
- for (tem = BLOCK_VARS (t); tem; tem = TREE_CHAIN (tem))
- fld_worklist_push (tem, fld);
- for (tem = BLOCK_SUBBLOCKS (t); tem; tem = BLOCK_CHAIN (tem))
+ for (tree *tem = &BLOCK_VARS (t); *tem; )
+ {
+ if (TREE_CODE (*tem) != VAR_DECL
+ || TREE_STATIC (*tem))
+ {
+ gcc_assert (TREE_CODE (*tem) != RESULT_DECL
+ && TREE_CODE (*tem) != PARM_DECL);
+ *tem = TREE_CHAIN (*tem);
+ }
+ else
+ {
+ fld_worklist_push (*tem, fld);
+ tem = &TREE_CHAIN (*tem);
+ }
+ }
+ for (tree tem = BLOCK_SUBBLOCKS (t); tem; tem = BLOCK_CHAIN (tem))
fld_worklist_push (tem, fld);
fld_worklist_push (BLOCK_ABSTRACT_ORIGIN (t), fld);
}
Index: testsuite/g++.dg/lto/pr84805_0.C
===================================================================
--- testsuite/g++.dg/lto/pr84805_0.C (revision 261546)
+++ testsuite/g++.dg/lto/pr84805_0.C (working copy)
@@ -23,7 +23,7 @@ template < typename _Tp, _Lock_policy, b
bool = is_void::value >
class __shared_ptr_access {};
template < typename _Tp, _Lock_policy _Lp >
-class __shared_ptr : __shared_ptr_access< _Tp, _Lp > { // { dg-lto-warning "7: type 'struct __shared_ptr' violates the C\\+\\+ One Definition Rule" }
+class __shared_ptr : __shared_ptr_access< _Tp, _Lp > {
using element_type = _Tp;
element_type *_M_ptr;
__shared_count< _Lp > _M_refcount;
@@ -90,7 +90,7 @@ class ExtNameBuff;
class ExtSheetBuffer;
class ExcelToSc;
class XclImpColRowSettings;
-struct RootData { // { dg-lto-warning "8: type 'struct RootData' violates the C\\+\\+ One Definition Rule" }
+struct RootData {
BiffTyp eDateiTyp;
ExtSheetBuffer *pExtSheetBuff;
SharedFormulaBuffer *pShrfmlaBuff;
@@ -105,7 +105,7 @@ class ScExtDocOptions;
class XclFontPropSetHelper;
class XclChPropSetHelper;
class XclTracer;
-struct XclRootData { // { dg-lto-warning "8: type 'struct XclRootData' violates the C\\+\\+ One Definition Rule" }
+struct XclRootData {
typedef std::shared_ptr< ScEditEngineDefaulter > ScEEDefaulterRef;
typedef std::shared_ptr< ScHeaderEditEngine > ScHeaderEERef;
typedef std::shared_ptr< EditEngine > EditEngineRef;
@@ -141,12 +141,12 @@ struct XclRootData { // { dg-lto-warning
RootDataRef mxRD;
virtual ~XclRootData();
};
-class XclRoot { // { dg-lto-warning "7: type 'struct XclRoot' violates the C\\+\\+ One Definition Rule" }
+class XclRoot {
public:
virtual ~XclRoot();
XclRootData &mrData;
};
-class XclImpRoot : XclRoot {}; // { dg-lto-warning "7: type 'struct XclImpRoot' violates the C\\+\\+ One Definition Rule" }
+class XclImpRoot : XclRoot {};
class XclImpColRowSettings : XclImpRoot {};
void lcl_ExportExcelBiff() {
XclRootData aExpData();
Index: testsuite/g++.dg/lto/pr84805_1.C
===================================================================
--- testsuite/g++.dg/lto/pr84805_1.C (revision 261546)
+++ testsuite/g++.dg/lto/pr84805_1.C (working copy)
@@ -1,9 +1,9 @@
-class XclRoot {
+class XclRoot { // { dg-lto-warning "7: type 'struct XclRoot' violates the C\\+\\+ One Definition Rule" }
public:
virtual ~XclRoot();
};
class XclImpRoot : XclRoot {};
-struct RootData {
+struct RootData { // { dg-lto-warning "8: type 'struct RootData' violates the C\\+\\+ One Definition Rule" }
XclImpRoot pIR;
};
class ExcRoot {