Discussion:
[GOOGLE] Skip fake LIPO edges when replacing calls with local alias
Teresa Johnson
2014-10-03 16:27:00 UTC
Permalink
Adds handling in this block of code (new in gcc/4_9 and therefore
google/4_9) for LIPO fake edges for indirect calls, which don't have a
call_stmt set and cannot be redirected.

Passes regression tests, ok for google/4_9 branch?

Teresa

2014-10-03 Teresa Johnson <***@google.com>

Google ref b/17378050
* ipa.c (function_and_variable_visibility): Skip LIPO fake indirect
call edges.

Index: ipa.c
===================================================================
--- ipa.c (revision 215830)
+++ ipa.c (working copy)
@@ -1146,12 +1146,15 @@ function_and_variable_visibility (bool whole_progr
if (node->callers && can_replace_by_local_alias (node))
{
struct cgraph_node *alias = cgraph
(symtab_nonoverwritable_alias (node));
+ struct cgraph_edge *e, *next_caller;

if (alias && alias != node)
{
- while (node->callers)
+ for (e = node->callers; e; e = next_caller)
{
- struct cgraph_edge *e = node->callers;
+ next_caller = e->next_caller;
+ if (L_IPO_COMP_MODE && cgraph_is_fake_indirect_call_edge (e))
+ continue;

cgraph_redirect_edge_callee (e, alias);
if (gimple_has_body_p (e->caller->decl))
--
Teresa Johnson | Software Engineer | ***@google.com | 408-460-2413
Xinliang David Li
2014-10-03 16:31:41 UTC
Permalink
The name 'e' is used for both outer scope edge and inner scope one.
This is confusing.

David
Post by Teresa Johnson
Adds handling in this block of code (new in gcc/4_9 and therefore
google/4_9) for LIPO fake edges for indirect calls, which don't have a
call_stmt set and cannot be redirected.
Passes regression tests, ok for google/4_9 branch?
Teresa
Google ref b/17378050
* ipa.c (function_and_variable_visibility): Skip LIPO fake indirect
call edges.
Index: ipa.c
===================================================================
--- ipa.c (revision 215830)
+++ ipa.c (working copy)
@@ -1146,12 +1146,15 @@ function_and_variable_visibility (bool whole_progr
if (node->callers && can_replace_by_local_alias (node))
{
struct cgraph_node *alias = cgraph
(symtab_nonoverwritable_alias (node));
+ struct cgraph_edge *e, *next_caller;
if (alias && alias != node)
{
- while (node->callers)
+ for (e = node->callers; e; e = next_caller)
{
- struct cgraph_edge *e = node->callers;
+ next_caller = e->next_caller;
+ if (L_IPO_COMP_MODE && cgraph_is_fake_indirect_call_edge (e))
+ continue;
cgraph_redirect_edge_callee (e, alias);
if (gimple_has_body_p (e->caller->decl))
--
Teresa Johnson
2014-10-03 16:45:53 UTC
Permalink
Post by Xinliang David Li
The name 'e' is used for both outer scope edge and inner scope one.
No, the declaration was moved from the inner scope to the outer scope.

Teresa
Post by Xinliang David Li
This is confusing.
David
Post by Teresa Johnson
Adds handling in this block of code (new in gcc/4_9 and therefore
google/4_9) for LIPO fake edges for indirect calls, which don't have a
call_stmt set and cannot be redirected.
Passes regression tests, ok for google/4_9 branch?
Teresa
Google ref b/17378050
* ipa.c (function_and_variable_visibility): Skip LIPO fake indirect
call edges.
Index: ipa.c
===================================================================
--- ipa.c (revision 215830)
+++ ipa.c (working copy)
@@ -1146,12 +1146,15 @@ function_and_variable_visibility (bool whole_progr
if (node->callers && can_replace_by_local_alias (node))
{
struct cgraph_node *alias = cgraph
(symtab_nonoverwritable_alias (node));
+ struct cgraph_edge *e, *next_caller;
if (alias && alias != node)
{
- while (node->callers)
+ for (e = node->callers; e; e = next_caller)
{
- struct cgraph_edge *e = node->callers;
+ next_caller = e->next_caller;
+ if (L_IPO_COMP_MODE && cgraph_is_fake_indirect_call_edge (e))
+ continue;
cgraph_redirect_edge_callee (e, alias);
if (gimple_has_body_p (e->caller->decl))
--
--
Teresa Johnson | Software Engineer | ***@google.com | 408-460-2413
Xinliang David Li
2014-10-03 16:48:45 UTC
Permalink
oops -- misread it :)

Ok.

David
Post by Teresa Johnson
Post by Xinliang David Li
The name 'e' is used for both outer scope edge and inner scope one.
No, the declaration was moved from the inner scope to the outer scope.
Teresa
Post by Xinliang David Li
This is confusing.
David
Post by Teresa Johnson
Adds handling in this block of code (new in gcc/4_9 and therefore
google/4_9) for LIPO fake edges for indirect calls, which don't have a
call_stmt set and cannot be redirected.
Passes regression tests, ok for google/4_9 branch?
Teresa
Google ref b/17378050
* ipa.c (function_and_variable_visibility): Skip LIPO fake indirect
call edges.
Index: ipa.c
===================================================================
--- ipa.c (revision 215830)
+++ ipa.c (working copy)
@@ -1146,12 +1146,15 @@ function_and_variable_visibility (bool whole_progr
if (node->callers && can_replace_by_local_alias (node))
{
struct cgraph_node *alias = cgraph
(symtab_nonoverwritable_alias (node));
+ struct cgraph_edge *e, *next_caller;
if (alias && alias != node)
{
- while (node->callers)
+ for (e = node->callers; e; e = next_caller)
{
- struct cgraph_edge *e = node->callers;
+ next_caller = e->next_caller;
+ if (L_IPO_COMP_MODE && cgraph_is_fake_indirect_call_edge (e))
+ continue;
cgraph_redirect_edge_callee (e, alias);
if (gimple_has_body_p (e->caller->decl))
--
--
Loading...