aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2018-05-15 18:39:43 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2018-05-15 16:39:43 +0000
commitab168044871f9984ba878720b6391b20cc77ebb2 (patch)
treeac5803ea082a9a4d8e6e8bcfcb37acdbb89b3d40
parent5f150326b336830ac8e53a7072451df2b6e75352 (diff)
downloadgcc-ab168044871f9984ba878720b6391b20cc77ebb2.zip
gcc-ab168044871f9984ba878720b6391b20cc77ebb2.tar.gz
gcc-ab168044871f9984ba878720b6391b20cc77ebb2.tar.bz2
re PR lto/85583 (lto1: internal compiler error: in lto_balanced_map, at lto/lto-partition.c:833)
PR lto/85583 * lto-partition.c (account_reference_p): Do not account references from aliases; do not account refernces from external initializers. From-SVN: r260266
-rw-r--r--gcc/lto/ChangeLog7
-rw-r--r--gcc/lto/lto-partition.c23
2 files changed, 26 insertions, 4 deletions
diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog
index 77e5915..cd976fa 100644
--- a/gcc/lto/ChangeLog
+++ b/gcc/lto/ChangeLog
@@ -1,3 +1,10 @@
+2018-05-18 Jan Hubicka <jh@suse.cz>
+
+ PR lto/85583
+ * lto-partition.c (account_reference_p): Do not account
+ references from aliases; do not account refernces from
+ external initializers.
+
2018-04-30 Jan Hubicka <jh@suse.cz>
* lto.c (cmp_partitions_size): Remove.
diff --git a/gcc/lto/lto-partition.c b/gcc/lto/lto-partition.c
index 637e5e2..fd796e1 100644
--- a/gcc/lto/lto-partition.c
+++ b/gcc/lto/lto-partition.c
@@ -439,12 +439,27 @@ account_reference_p (symtab_node *n1, symtab_node *n2)
{
if (cgraph_node *cnode = dyn_cast <cgraph_node *> (n1))
n1 = cnode;
+ /* Do not account references from aliases - they are never split across
+ partitions. */
+ if (n1->alias)
+ return false;
/* Do not account recursion - the code below will handle it incorrectly
- otherwise. Also do not account references to external symbols.
- They will never become local. */
+ otherwise. Do not account references to external symbols: they will
+ never become local. Finally do not account references to duplicated
+ symbols: they will be always local. */
if (n1 == n2
- || DECL_EXTERNAL (n2->decl)
- || !n2->definition)
+ || !n2->definition
+ || n2->get_partitioning_class () != SYMBOL_PARTITION)
+ return false;
+ /* If referring node is external symbol do not account it to boundary
+ cost. Those are added into units only to enable possible constant
+ folding and devirtulization.
+
+ Here we do not know if it will ever be added to some partition
+ (this is decided by compute_ltrans_boundary) and second it is not
+ that likely that constant folding will actually use the reference. */
+ if (contained_in_symbol (n1)
+ ->get_partitioning_class () == SYMBOL_EXTERNAL)
return false;
return true;
}