Commit da66d596 by Jan Hubicka Committed by Jan Hubicka

revert: symtab.c (symtab_node::reset_section): New method.


	Revert:
	* symtab.c (symtab_node::reset_section): New method.
	* cgraph.c (cgraph_node_cannot_be_local_p_1): Accept non-local
	for localization.
	* cgraph.h (reset_section): Declare.
	* ipa-inline-analysis.c (do_estimate_growth): Check for comdat groups;
	do not consider comdat locals.
	* cgraphclones.c (set_new_clone_decl_and_node_flags): Get section
	for new symbol.
	* ipa-visiblity.c (cgraph_externally_visible_p): Cleanup.
	(update_visibility_by_resolution_info): Consider UNDEF; fix checking;
	reset sections of symbols dragged out of the comdats.
	(function_and_variable_visibility): Reset sections of localized symbols.

From-SVN: r211710
parent 9e9f6bf0
2014-06-16 Jan Hubicka <hubicka@ucw.cz>
Revert:
* symtab.c (symtab_node::reset_section): New method.
* cgraph.c (cgraph_node_cannot_be_local_p_1): Accept non-local
for localization.
* cgraph.h (reset_section): Declare.
* ipa-inline-analysis.c (do_estimate_growth): Check for comdat groups;
do not consider comdat locals.
* cgraphclones.c (set_new_clone_decl_and_node_flags): Get section
for new symbol.
* ipa-visiblity.c (cgraph_externally_visible_p): Cleanup.
(update_visibility_by_resolution_info): Consider UNDEF; fix checking;
reset sections of symbols dragged out of the comdats.
(function_and_variable_visibility): Reset sections of localized symbols.
2014-06-16 Richard Biener <rguenther@suse.de> 2014-06-16 Richard Biener <rguenther@suse.de>
PR tree-optimization/61482 PR tree-optimization/61482
......
...@@ -2169,7 +2169,6 @@ cgraph_node_cannot_be_local_p_1 (struct cgraph_node *node, ...@@ -2169,7 +2169,6 @@ cgraph_node_cannot_be_local_p_1 (struct cgraph_node *node,
&& !node->forced_by_abi && !node->forced_by_abi
&& !symtab_used_from_object_file_p (node) && !symtab_used_from_object_file_p (node)
&& !node->same_comdat_group) && !node->same_comdat_group)
|| DECL_EXTERNAL (node->decl)
|| !node->externally_visible)); || !node->externally_visible));
} }
...@@ -2260,14 +2259,14 @@ cgraph_make_node_local_1 (struct cgraph_node *node, void *data ATTRIBUTE_UNUSED) ...@@ -2260,14 +2259,14 @@ cgraph_make_node_local_1 (struct cgraph_node *node, void *data ATTRIBUTE_UNUSED)
{ {
symtab_make_decl_local (node->decl); symtab_make_decl_local (node->decl);
node->set_section (NULL);
node->set_comdat_group (NULL); node->set_comdat_group (NULL);
node->externally_visible = false; node->externally_visible = false;
node->forced_by_abi = false; node->forced_by_abi = false;
node->local.local = true; node->local.local = true;
node->reset_section (); node->set_section (NULL);
node->unique_name = (node->resolution == LDPR_PREVAILING_DEF_IRONLY node->unique_name = (node->resolution == LDPR_PREVAILING_DEF_IRONLY
|| node->unique_name || node->resolution == LDPR_PREVAILING_DEF_IRONLY_EXP);
|| node->resolution == LDPR_PREVAILING_DEF_IRONLY_EXP);
node->resolution = LDPR_PREVAILING_DEF_IRONLY; node->resolution = LDPR_PREVAILING_DEF_IRONLY;
gcc_assert (cgraph_function_body_availability (node) == AVAIL_LOCAL); gcc_assert (cgraph_function_body_availability (node) == AVAIL_LOCAL);
} }
......
...@@ -208,7 +208,6 @@ public: ...@@ -208,7 +208,6 @@ public:
/* Set section for symbol and its aliases. */ /* Set section for symbol and its aliases. */
void set_section (const char *section); void set_section (const char *section);
void set_section_for_node (const char *section); void set_section_for_node (const char *section);
void reset_section ();
}; };
enum availability enum availability
......
...@@ -293,7 +293,6 @@ set_new_clone_decl_and_node_flags (cgraph_node *new_node) ...@@ -293,7 +293,6 @@ set_new_clone_decl_and_node_flags (cgraph_node *new_node)
new_node->externally_visible = 0; new_node->externally_visible = 0;
new_node->local.local = 1; new_node->local.local = 1;
new_node->lowered = true; new_node->lowered = true;
new_node->reset_section ();
} }
/* Duplicate thunk THUNK if necessary but make it to refer to NODE. /* Duplicate thunk THUNK if necessary but make it to refer to NODE.
......
...@@ -3877,7 +3877,7 @@ do_estimate_growth (struct cgraph_node *node) ...@@ -3877,7 +3877,7 @@ do_estimate_growth (struct cgraph_node *node)
/* COMDAT functions are very often not shared across multiple units /* COMDAT functions are very often not shared across multiple units
since they come from various template instantiations. since they come from various template instantiations.
Take this into account. */ Take this into account. */
else if (node->externally_visible && node->get_comdat_group () else if (DECL_COMDAT (node->decl)
&& cgraph_can_remove_if_no_direct_calls_p (node)) && cgraph_can_remove_if_no_direct_calls_p (node))
d.growth -= (info->size d.growth -= (info->size
* (100 - PARAM_VALUE (PARAM_COMDAT_SHARING_PROBABILITY)) * (100 - PARAM_VALUE (PARAM_COMDAT_SHARING_PROBABILITY))
...@@ -3928,7 +3928,7 @@ growth_likely_positive (struct cgraph_node *node, int edge_growth ATTRIBUTE_UNUS ...@@ -3928,7 +3928,7 @@ growth_likely_positive (struct cgraph_node *node, int edge_growth ATTRIBUTE_UNUS
&& (ret = node_growth_cache[node->uid])) && (ret = node_growth_cache[node->uid]))
return ret > 0; return ret > 0;
if (!cgraph_will_be_removed_from_program_if_no_direct_calls (node) if (!cgraph_will_be_removed_from_program_if_no_direct_calls (node)
&& (!node->externally_visible || !node->get_comdat_group () && (!DECL_COMDAT (node->decl)
|| !cgraph_can_remove_if_no_direct_calls_p (node))) || !cgraph_can_remove_if_no_direct_calls_p (node)))
return true; return true;
max_callers = inline_summary (node)->size * 4 / edge_growth + 2; max_callers = inline_summary (node)->size * 4 / edge_growth + 2;
......
...@@ -236,7 +236,7 @@ cgraph_externally_visible_p (struct cgraph_node *node, ...@@ -236,7 +236,7 @@ cgraph_externally_visible_p (struct cgraph_node *node,
return true; return true;
if (node->resolution == LDPR_PREVAILING_DEF_IRONLY) if (node->resolution == LDPR_PREVAILING_DEF_IRONLY)
return false; return false;
/* When doing LTO or whole program, we can bring COMDAT functions static. /* When doing LTO or whole program, we can bring COMDAT functoins static.
This improves code quality and we know we will duplicate them at most twice This improves code quality and we know we will duplicate them at most twice
(in the case that we are not using plugin and link with object file (in the case that we are not using plugin and link with object file
implementing same COMDAT) */ implementing same COMDAT) */
...@@ -295,6 +295,8 @@ varpool_externally_visible_p (varpool_node *vnode) ...@@ -295,6 +295,8 @@ varpool_externally_visible_p (varpool_node *vnode)
Even if the linker clams the symbol is unused, never bring internal Even if the linker clams the symbol is unused, never bring internal
symbols that are declared by user as used or externally visible. symbols that are declared by user as used or externally visible.
This is needed for i.e. references from asm statements. */ This is needed for i.e. references from asm statements. */
if (symtab_used_from_object_file_p (vnode))
return true;
if (vnode->resolution == LDPR_PREVAILING_DEF_IRONLY) if (vnode->resolution == LDPR_PREVAILING_DEF_IRONLY)
return false; return false;
...@@ -384,8 +386,7 @@ update_visibility_by_resolution_info (symtab_node * node) ...@@ -384,8 +386,7 @@ update_visibility_by_resolution_info (symtab_node * node)
if (!node->externally_visible if (!node->externally_visible
|| (!DECL_WEAK (node->decl) && !DECL_ONE_ONLY (node->decl)) || (!DECL_WEAK (node->decl) && !DECL_ONE_ONLY (node->decl))
|| node->resolution == LDPR_UNKNOWN || node->resolution == LDPR_UNKNOWN)
|| node->resolution == LDPR_UNDEF)
return; return;
define = (node->resolution == LDPR_PREVAILING_DEF_IRONLY define = (node->resolution == LDPR_PREVAILING_DEF_IRONLY
...@@ -396,7 +397,7 @@ update_visibility_by_resolution_info (symtab_node * node) ...@@ -396,7 +397,7 @@ update_visibility_by_resolution_info (symtab_node * node)
if (node->same_comdat_group) if (node->same_comdat_group)
for (symtab_node *next = node->same_comdat_group; for (symtab_node *next = node->same_comdat_group;
next != node; next = next->same_comdat_group) next != node; next = next->same_comdat_group)
gcc_assert (!next->externally_visible gcc_assert (!node->externally_visible
|| define == (next->resolution == LDPR_PREVAILING_DEF_IRONLY || define == (next->resolution == LDPR_PREVAILING_DEF_IRONLY
|| next->resolution == LDPR_PREVAILING_DEF || next->resolution == LDPR_PREVAILING_DEF
|| next->resolution == LDPR_PREVAILING_DEF_IRONLY_EXP)); || next->resolution == LDPR_PREVAILING_DEF_IRONLY_EXP));
...@@ -410,15 +411,11 @@ update_visibility_by_resolution_info (symtab_node * node) ...@@ -410,15 +411,11 @@ update_visibility_by_resolution_info (symtab_node * node)
if (next->externally_visible if (next->externally_visible
&& !define) && !define)
DECL_EXTERNAL (next->decl) = true; DECL_EXTERNAL (next->decl) = true;
if (!next->alias)
next->reset_section ();
} }
node->set_comdat_group (NULL); node->set_comdat_group (NULL);
DECL_WEAK (node->decl) = false; DECL_WEAK (node->decl) = false;
if (!define) if (!define)
DECL_EXTERNAL (node->decl) = true; DECL_EXTERNAL (node->decl) = true;
if (!node->alias)
node->reset_section ();
symtab_dissolve_same_comdat_group_list (node); symtab_dissolve_same_comdat_group_list (node);
} }
...@@ -479,7 +476,7 @@ function_and_variable_visibility (bool whole_program) ...@@ -479,7 +476,7 @@ function_and_variable_visibility (bool whole_program)
symtab_dissolve_same_comdat_group_list (node); symtab_dissolve_same_comdat_group_list (node);
} }
gcc_assert ((!DECL_WEAK (node->decl) gcc_assert ((!DECL_WEAK (node->decl)
&& !DECL_COMDAT (node->decl)) && !DECL_COMDAT (node->decl))
|| TREE_PUBLIC (node->decl) || TREE_PUBLIC (node->decl)
|| node->weakref || node->weakref
|| DECL_EXTERNAL (node->decl)); || DECL_EXTERNAL (node->decl));
...@@ -497,7 +494,6 @@ function_and_variable_visibility (bool whole_program) ...@@ -497,7 +494,6 @@ function_and_variable_visibility (bool whole_program)
&& node->definition && !node->weakref && node->definition && !node->weakref
&& !DECL_EXTERNAL (node->decl)) && !DECL_EXTERNAL (node->decl))
{ {
bool reset = TREE_PUBLIC (node->decl);
gcc_assert (whole_program || in_lto_p gcc_assert (whole_program || in_lto_p
|| !TREE_PUBLIC (node->decl)); || !TREE_PUBLIC (node->decl));
node->unique_name = ((node->resolution == LDPR_PREVAILING_DEF_IRONLY node->unique_name = ((node->resolution == LDPR_PREVAILING_DEF_IRONLY
...@@ -516,9 +512,9 @@ function_and_variable_visibility (bool whole_program) ...@@ -516,9 +512,9 @@ function_and_variable_visibility (bool whole_program)
next = next->same_comdat_group) next = next->same_comdat_group)
{ {
next->set_comdat_group (NULL); next->set_comdat_group (NULL);
if (!next->alias)
next->set_section (NULL);
symtab_make_decl_local (next->decl); symtab_make_decl_local (next->decl);
if (!node->alias)
node->reset_section ();
next->unique_name = ((next->resolution == LDPR_PREVAILING_DEF_IRONLY next->unique_name = ((next->resolution == LDPR_PREVAILING_DEF_IRONLY
|| next->unique_name || next->unique_name
|| next->resolution == LDPR_PREVAILING_DEF_IRONLY_EXP) || next->resolution == LDPR_PREVAILING_DEF_IRONLY_EXP)
...@@ -532,9 +528,9 @@ function_and_variable_visibility (bool whole_program) ...@@ -532,9 +528,9 @@ function_and_variable_visibility (bool whole_program)
} }
if (TREE_PUBLIC (node->decl)) if (TREE_PUBLIC (node->decl))
node->set_comdat_group (NULL); node->set_comdat_group (NULL);
if (DECL_COMDAT (node->decl) && !node->alias)
node->set_section (NULL);
symtab_make_decl_local (node->decl); symtab_make_decl_local (node->decl);
if (reset && !node->alias)
node->reset_section ();
} }
if (node->thunk.thunk_p if (node->thunk.thunk_p
...@@ -636,7 +632,6 @@ function_and_variable_visibility (bool whole_program) ...@@ -636,7 +632,6 @@ function_and_variable_visibility (bool whole_program)
if (!vnode->externally_visible if (!vnode->externally_visible
&& !vnode->weakref) && !vnode->weakref)
{ {
bool reset = TREE_PUBLIC (vnode->decl);
gcc_assert (in_lto_p || whole_program || !TREE_PUBLIC (vnode->decl)); gcc_assert (in_lto_p || whole_program || !TREE_PUBLIC (vnode->decl));
vnode->unique_name = ((vnode->resolution == LDPR_PREVAILING_DEF_IRONLY vnode->unique_name = ((vnode->resolution == LDPR_PREVAILING_DEF_IRONLY
|| vnode->resolution == LDPR_PREVAILING_DEF_IRONLY_EXP) || vnode->resolution == LDPR_PREVAILING_DEF_IRONLY_EXP)
...@@ -652,9 +647,9 @@ function_and_variable_visibility (bool whole_program) ...@@ -652,9 +647,9 @@ function_and_variable_visibility (bool whole_program)
next = next->same_comdat_group) next = next->same_comdat_group)
{ {
next->set_comdat_group (NULL); next->set_comdat_group (NULL);
symtab_make_decl_local (next->decl);
if (!next->alias) if (!next->alias)
next->reset_section (); next->set_section (NULL);
symtab_make_decl_local (next->decl);
next->unique_name = ((next->resolution == LDPR_PREVAILING_DEF_IRONLY next->unique_name = ((next->resolution == LDPR_PREVAILING_DEF_IRONLY
|| next->unique_name || next->unique_name
|| next->resolution == LDPR_PREVAILING_DEF_IRONLY_EXP) || next->resolution == LDPR_PREVAILING_DEF_IRONLY_EXP)
...@@ -664,9 +659,9 @@ function_and_variable_visibility (bool whole_program) ...@@ -664,9 +659,9 @@ function_and_variable_visibility (bool whole_program)
} }
if (TREE_PUBLIC (vnode->decl)) if (TREE_PUBLIC (vnode->decl))
vnode->set_comdat_group (NULL); vnode->set_comdat_group (NULL);
if (DECL_COMDAT (vnode->decl) && !vnode->alias)
vnode->set_section (NULL);
symtab_make_decl_local (vnode->decl); symtab_make_decl_local (vnode->decl);
if (reset && !vnode->alias)
vnode->reset_section ();
vnode->resolution = LDPR_PREVAILING_DEF_IRONLY; vnode->resolution = LDPR_PREVAILING_DEF_IRONLY;
} }
update_visibility_by_resolution_info (vnode); update_visibility_by_resolution_info (vnode);
......
...@@ -1176,21 +1176,6 @@ symtab_node::set_section (const char *section) ...@@ -1176,21 +1176,6 @@ symtab_node::set_section (const char *section)
symtab_for_node_and_aliases (this, set_section_1, const_cast<char *>(section), true); symtab_for_node_and_aliases (this, set_section_1, const_cast<char *>(section), true);
} }
/* Reset section of NODE. That is when NODE is being brought local
we may want to clear section produced for comdat group and depending
on function-sections produce now, local, unique section for it. */
void
symtab_node::reset_section ()
{
if (!this->implicit_section)
return;
this->set_section (NULL);
resolve_unique_section (this->decl, 0,
is_a <cgraph_node *> (this)
? flag_function_sections : flag_data_sections);
}
/* Worker for symtab_resolve_alias. */ /* Worker for symtab_resolve_alias. */
static bool static bool
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment