aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/cgraph.h2
-rw-r--r--gcc/ipa.c9
-rw-r--r--gcc/varpool.c10
4 files changed, 18 insertions, 12 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 9981622..0db9147 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+2012-03-24 Jan Hubicka <jh@suse.cz>
+
+ PR lto/51663
+ * varpool.c (varpool_finalize_decl): Handle toplevel_reorder here.
+ (decide_is_variable_needed): Do not handle toplevel reorder here.
+ * cgraph.h (varpool_can_remove_if_no_refs): Likewise.
+ * ipa.c (cgraph_remove_unreachable_nodes): Remove unreachable vars
+ even at -O0.
+
2012-03-24 Eric Botcazou <ebotcazou@adacore.com>
* expr.c (optimize_bitfield_assignment_op) <BIT_IOR_EXPR>: Use str_mode
diff --git a/gcc/cgraph.h b/gcc/cgraph.h
index db4bcea..93efd94 100644
--- a/gcc/cgraph.h
+++ b/gcc/cgraph.h
@@ -947,8 +947,6 @@ static inline bool
varpool_can_remove_if_no_refs (struct varpool_node *node)
{
return (!node->force_output && !node->used_from_other_partition
- && (flag_toplevel_reorder || DECL_COMDAT (node->decl)
- || DECL_ARTIFICIAL (node->decl))
&& (DECL_COMDAT (node->decl) || !node->externally_visible));
}
diff --git a/gcc/ipa.c b/gcc/ipa.c
index 388291a..88dd907 100644
--- a/gcc/ipa.c
+++ b/gcc/ipa.c
@@ -419,11 +419,6 @@ cgraph_remove_unreachable_nodes (bool before_inlining_p, FILE *file)
if (file)
fprintf (file, "\n");
- /* We must release unused extern inlines or sanity checking will fail. Rest of transformations
- are undesirable at -O0 since we do not want to remove anything. */
- if (!optimize)
- return changed;
-
if (file)
fprintf (file, "Reclaiming variables:");
for (vnode = varpool_nodes; vnode; vnode = vnext)
@@ -463,6 +458,10 @@ cgraph_remove_unreachable_nodes (bool before_inlining_p, FILE *file)
if (file)
fprintf (file, "\n");
+ /* Rest of transformations are undesirable at -O0. */
+ if (!optimize)
+ return changed;
+
#ifdef ENABLE_CHECKING
verify_cgraph ();
#endif
diff --git a/gcc/varpool.c b/gcc/varpool.c
index c2d88c3..e064f7b 100644
--- a/gcc/varpool.c
+++ b/gcc/varpool.c
@@ -334,10 +334,6 @@ decide_is_variable_needed (struct varpool_node *node, tree decl)
&& !DECL_EXTERNAL (decl))
return true;
- /* When not reordering top level variables, we have to assume that
- we are going to keep everything. */
- if (!flag_toplevel_reorder)
- return true;
return false;
}
@@ -405,7 +401,11 @@ varpool_finalize_decl (tree decl)
if (node->needed)
varpool_enqueue_needed_node (node);
node->finalized = true;
- if (TREE_THIS_VOLATILE (decl) || DECL_PRESERVE_P (decl))
+ if (TREE_THIS_VOLATILE (decl) || DECL_PRESERVE_P (decl)
+ /* Traditionally we do not eliminate static variables when not
+ optimizing and when not doing toplevel reoder. */
+ || (!flag_toplevel_reorder && !DECL_COMDAT (node->decl)
+ && !DECL_ARTIFICIAL (node->decl)))
node->force_output = true;
if (decide_is_variable_needed (node, decl))