public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/aoliva/heads/testme)] [strub] tolerate call_stmt-less cgraph_edges
@ 2023-06-08 4:48 Alexandre Oliva
0 siblings, 0 replies; 7+ messages in thread
From: Alexandre Oliva @ 2023-06-08 4:48 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:397d45c9d354f396462a4b7f6c97c54bfa7cface
commit 397d45c9d354f396462a4b7f6c97c54bfa7cface
Author: Alexandre Oliva <oliva@adacore.com>
Date: Thu Jun 8 01:43:13 2023 -0300
[strub] tolerate call_stmt-less cgraph_edges
cgraph::analyze creates cgraph_edges without call_stmt for thunks.
Skip edges without a call_stmt all over.
for gcc/ChangeLog
* ipa-strub.cc (calls_builtin_apply_args_p): Check for NULL
call_stmt in cgraph_edges.
(called_directly_with_type_override_p): Likewise.
(can_strub_internally_p): Likewise.
(distinctify_node_type): Likewise.
(verify_strub): Likewise.
(pass_ipa_strub::adjust_at_calls_calls): Likewise.
(pass_ipa_strub::execute): Likewise.
(pass_ipa_strub::adjust_at_calls_call): Require a call_stmt.
Change-Id: I1c44af2d050bcef86bcc01aacc539fa8b4e52f3d
TN: U611-048
Diff:
---
gcc/ipa-strub.cc | 28 +++++++++++++++++++++++++---
1 file changed, 25 insertions(+), 3 deletions(-)
diff --git a/gcc/ipa-strub.cc b/gcc/ipa-strub.cc
index d61b7e2e36e..5fc4fca550d 100644
--- a/gcc/ipa-strub.cc
+++ b/gcc/ipa-strub.cc
@@ -489,7 +489,9 @@ calls_builtin_apply_args_p (cgraph_node *node, bool report = false)
if (!report)
break;
- sorry_at (gimple_location (e->call_stmt),
+ sorry_at (e->call_stmt
+ ? gimple_location (e->call_stmt)
+ : DECL_SOURCE_LOCATION (node->decl),
"at-calls %<strub%> does not support call to %qD",
cdecl);
}
@@ -607,7 +609,7 @@ static bool
called_directly_with_type_override_p (cgraph_node *node, void *)
{
for (cgraph_edge *e = node->callers; e; e = e->next_caller)
- if (strub_call_fntype_override_p (e->call_stmt))
+ if (e->call_stmt && strub_call_fntype_override_p (e->call_stmt))
return true;
return false;
@@ -694,7 +696,9 @@ can_strub_internally_p (cgraph_node *node, bool report = false)
if (!report)
return result;
- sorry_at (gimple_location (e->call_stmt),
+ sorry_at (e->call_stmt
+ ? gimple_location (e->call_stmt)
+ : DECL_SOURCE_LOCATION (node->decl),
"%qD is not eligible for internal %<strub%> "
"because it calls %qD",
node->decl, cdecl);
@@ -1428,6 +1432,8 @@ distinctify_node_type (cgraph_node *node)
we'll adjust their fntypes then. */
for (cgraph_edge *e = node->callers; e; e = e->next_caller)
{
+ if (!e->call_stmt)
+ continue;
tree fnaddr = gimple_call_fn (e->call_stmt);
gcc_checking_assert (TREE_CODE (fnaddr) == ADDR_EXPR
&& TREE_OPERAND (fnaddr, 0) == node->decl);
@@ -1494,6 +1500,9 @@ verify_strub ()
{
gcc_checking_assert (e->indirect_unknown_callee);
+ if (!e->call_stmt)
+ continue;
+
enum strub_mode callee_mode
= effective_strub_mode_for_call (e->call_stmt, NULL);
@@ -1507,6 +1516,9 @@ verify_strub ()
{
gcc_checking_assert (!e->indirect_unknown_callee);
+ if (!e->call_stmt)
+ continue;
+
tree callee_fntype;
enum strub_mode callee_mode
= effective_strub_mode_for_call (e->call_stmt, &callee_fntype);
@@ -2282,6 +2294,7 @@ void
pass_ipa_strub::adjust_at_calls_call (cgraph_edge *e, int named_args,
tree callee_fntype)
{
+ gcc_checking_assert (e->call_stmt);
gcall *ocall = e->call_stmt;
gimple_stmt_iterator gsi = gsi_for_stmt (ocall);
@@ -2458,6 +2471,9 @@ pass_ipa_strub::adjust_at_calls_calls (cgraph_node *node)
{
gcc_checking_assert (e->indirect_unknown_callee);
+ if (!e->call_stmt)
+ continue;
+
tree callee_fntype;
enum strub_mode callee_mode
= effective_strub_mode_for_call (e->call_stmt, &callee_fntype);
@@ -2480,6 +2496,9 @@ pass_ipa_strub::adjust_at_calls_calls (cgraph_node *node)
{
gcc_checking_assert (!e->indirect_unknown_callee);
+ if (!e->call_stmt)
+ continue;
+
tree callee_fntype;
enum strub_mode callee_mode
= effective_strub_mode_for_call (e->call_stmt, &callee_fntype);
@@ -3283,6 +3302,9 @@ pass_ipa_strub::execute (function *)
|| is_stdarg || apply_args)
for (cgraph_edge *e = nnode->callees, *enext; e; e = enext)
{
+ if (!e->call_stmt)
+ continue;
+
gcall *call = e->call_stmt;
gimple_stmt_iterator gsi = gsi_for_stmt (call);
tree fndecl = e->callee->decl;
^ permalink raw reply [flat|nested] 7+ messages in thread
* [gcc(refs/users/aoliva/heads/testme)] [strub] tolerate call_stmt-less cgraph_edges
@ 2023-06-09 8:08 Alexandre Oliva
0 siblings, 0 replies; 7+ messages in thread
From: Alexandre Oliva @ 2023-06-09 8:08 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:e554447dd6bee3e664da5ad3993bc3dd2fec8f6d
commit e554447dd6bee3e664da5ad3993bc3dd2fec8f6d
Author: Alexandre Oliva <oliva@adacore.com>
Date: Thu Jun 8 01:44:03 2023 -0300
[strub] tolerate call_stmt-less cgraph_edges
cgraph::analyze creates cgraph_edges without call_stmt for thunks.
Skip edges without a call_stmt all over.
for gcc/ChangeLog
* ipa-strub.cc (calls_builtin_apply_args_p): Check for NULL
call_stmt in cgraph_edges.
(called_directly_with_type_override_p): Likewise.
(can_strub_internally_p): Likewise.
(distinctify_node_type): Likewise.
(verify_strub): Likewise.
(pass_ipa_strub::adjust_at_calls_calls): Likewise.
(pass_ipa_strub::execute): Likewise.
(pass_ipa_strub::adjust_at_calls_call): Require a call_stmt.
Diff:
---
gcc/ipa-strub.cc | 28 +++++++++++++++++++++++++---
1 file changed, 25 insertions(+), 3 deletions(-)
diff --git a/gcc/ipa-strub.cc b/gcc/ipa-strub.cc
index d61b7e2e36e..5fc4fca550d 100644
--- a/gcc/ipa-strub.cc
+++ b/gcc/ipa-strub.cc
@@ -489,7 +489,9 @@ calls_builtin_apply_args_p (cgraph_node *node, bool report = false)
if (!report)
break;
- sorry_at (gimple_location (e->call_stmt),
+ sorry_at (e->call_stmt
+ ? gimple_location (e->call_stmt)
+ : DECL_SOURCE_LOCATION (node->decl),
"at-calls %<strub%> does not support call to %qD",
cdecl);
}
@@ -607,7 +609,7 @@ static bool
called_directly_with_type_override_p (cgraph_node *node, void *)
{
for (cgraph_edge *e = node->callers; e; e = e->next_caller)
- if (strub_call_fntype_override_p (e->call_stmt))
+ if (e->call_stmt && strub_call_fntype_override_p (e->call_stmt))
return true;
return false;
@@ -694,7 +696,9 @@ can_strub_internally_p (cgraph_node *node, bool report = false)
if (!report)
return result;
- sorry_at (gimple_location (e->call_stmt),
+ sorry_at (e->call_stmt
+ ? gimple_location (e->call_stmt)
+ : DECL_SOURCE_LOCATION (node->decl),
"%qD is not eligible for internal %<strub%> "
"because it calls %qD",
node->decl, cdecl);
@@ -1428,6 +1432,8 @@ distinctify_node_type (cgraph_node *node)
we'll adjust their fntypes then. */
for (cgraph_edge *e = node->callers; e; e = e->next_caller)
{
+ if (!e->call_stmt)
+ continue;
tree fnaddr = gimple_call_fn (e->call_stmt);
gcc_checking_assert (TREE_CODE (fnaddr) == ADDR_EXPR
&& TREE_OPERAND (fnaddr, 0) == node->decl);
@@ -1494,6 +1500,9 @@ verify_strub ()
{
gcc_checking_assert (e->indirect_unknown_callee);
+ if (!e->call_stmt)
+ continue;
+
enum strub_mode callee_mode
= effective_strub_mode_for_call (e->call_stmt, NULL);
@@ -1507,6 +1516,9 @@ verify_strub ()
{
gcc_checking_assert (!e->indirect_unknown_callee);
+ if (!e->call_stmt)
+ continue;
+
tree callee_fntype;
enum strub_mode callee_mode
= effective_strub_mode_for_call (e->call_stmt, &callee_fntype);
@@ -2282,6 +2294,7 @@ void
pass_ipa_strub::adjust_at_calls_call (cgraph_edge *e, int named_args,
tree callee_fntype)
{
+ gcc_checking_assert (e->call_stmt);
gcall *ocall = e->call_stmt;
gimple_stmt_iterator gsi = gsi_for_stmt (ocall);
@@ -2458,6 +2471,9 @@ pass_ipa_strub::adjust_at_calls_calls (cgraph_node *node)
{
gcc_checking_assert (e->indirect_unknown_callee);
+ if (!e->call_stmt)
+ continue;
+
tree callee_fntype;
enum strub_mode callee_mode
= effective_strub_mode_for_call (e->call_stmt, &callee_fntype);
@@ -2480,6 +2496,9 @@ pass_ipa_strub::adjust_at_calls_calls (cgraph_node *node)
{
gcc_checking_assert (!e->indirect_unknown_callee);
+ if (!e->call_stmt)
+ continue;
+
tree callee_fntype;
enum strub_mode callee_mode
= effective_strub_mode_for_call (e->call_stmt, &callee_fntype);
@@ -3283,6 +3302,9 @@ pass_ipa_strub::execute (function *)
|| is_stdarg || apply_args)
for (cgraph_edge *e = nnode->callees, *enext; e; e = enext)
{
+ if (!e->call_stmt)
+ continue;
+
gcall *call = e->call_stmt;
gimple_stmt_iterator gsi = gsi_for_stmt (call);
tree fndecl = e->callee->decl;
^ permalink raw reply [flat|nested] 7+ messages in thread
* [gcc(refs/users/aoliva/heads/testme)] [strub] tolerate call_stmt-less cgraph_edges
@ 2023-06-09 6:26 Alexandre Oliva
0 siblings, 0 replies; 7+ messages in thread
From: Alexandre Oliva @ 2023-06-09 6:26 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:015382d5941a4994099680d5d02c411d692f0ba5
commit 015382d5941a4994099680d5d02c411d692f0ba5
Author: Alexandre Oliva <oliva@adacore.com>
Date: Thu Jun 8 01:44:03 2023 -0300
[strub] tolerate call_stmt-less cgraph_edges
cgraph::analyze creates cgraph_edges without call_stmt for thunks.
Skip edges without a call_stmt all over.
for gcc/ChangeLog
* ipa-strub.cc (calls_builtin_apply_args_p): Check for NULL
call_stmt in cgraph_edges.
(called_directly_with_type_override_p): Likewise.
(can_strub_internally_p): Likewise.
(distinctify_node_type): Likewise.
(verify_strub): Likewise.
(pass_ipa_strub::adjust_at_calls_calls): Likewise.
(pass_ipa_strub::execute): Likewise.
(pass_ipa_strub::adjust_at_calls_call): Require a call_stmt.
Diff:
---
gcc/ipa-strub.cc | 28 +++++++++++++++++++++++++---
1 file changed, 25 insertions(+), 3 deletions(-)
diff --git a/gcc/ipa-strub.cc b/gcc/ipa-strub.cc
index d61b7e2e36e..5fc4fca550d 100644
--- a/gcc/ipa-strub.cc
+++ b/gcc/ipa-strub.cc
@@ -489,7 +489,9 @@ calls_builtin_apply_args_p (cgraph_node *node, bool report = false)
if (!report)
break;
- sorry_at (gimple_location (e->call_stmt),
+ sorry_at (e->call_stmt
+ ? gimple_location (e->call_stmt)
+ : DECL_SOURCE_LOCATION (node->decl),
"at-calls %<strub%> does not support call to %qD",
cdecl);
}
@@ -607,7 +609,7 @@ static bool
called_directly_with_type_override_p (cgraph_node *node, void *)
{
for (cgraph_edge *e = node->callers; e; e = e->next_caller)
- if (strub_call_fntype_override_p (e->call_stmt))
+ if (e->call_stmt && strub_call_fntype_override_p (e->call_stmt))
return true;
return false;
@@ -694,7 +696,9 @@ can_strub_internally_p (cgraph_node *node, bool report = false)
if (!report)
return result;
- sorry_at (gimple_location (e->call_stmt),
+ sorry_at (e->call_stmt
+ ? gimple_location (e->call_stmt)
+ : DECL_SOURCE_LOCATION (node->decl),
"%qD is not eligible for internal %<strub%> "
"because it calls %qD",
node->decl, cdecl);
@@ -1428,6 +1432,8 @@ distinctify_node_type (cgraph_node *node)
we'll adjust their fntypes then. */
for (cgraph_edge *e = node->callers; e; e = e->next_caller)
{
+ if (!e->call_stmt)
+ continue;
tree fnaddr = gimple_call_fn (e->call_stmt);
gcc_checking_assert (TREE_CODE (fnaddr) == ADDR_EXPR
&& TREE_OPERAND (fnaddr, 0) == node->decl);
@@ -1494,6 +1500,9 @@ verify_strub ()
{
gcc_checking_assert (e->indirect_unknown_callee);
+ if (!e->call_stmt)
+ continue;
+
enum strub_mode callee_mode
= effective_strub_mode_for_call (e->call_stmt, NULL);
@@ -1507,6 +1516,9 @@ verify_strub ()
{
gcc_checking_assert (!e->indirect_unknown_callee);
+ if (!e->call_stmt)
+ continue;
+
tree callee_fntype;
enum strub_mode callee_mode
= effective_strub_mode_for_call (e->call_stmt, &callee_fntype);
@@ -2282,6 +2294,7 @@ void
pass_ipa_strub::adjust_at_calls_call (cgraph_edge *e, int named_args,
tree callee_fntype)
{
+ gcc_checking_assert (e->call_stmt);
gcall *ocall = e->call_stmt;
gimple_stmt_iterator gsi = gsi_for_stmt (ocall);
@@ -2458,6 +2471,9 @@ pass_ipa_strub::adjust_at_calls_calls (cgraph_node *node)
{
gcc_checking_assert (e->indirect_unknown_callee);
+ if (!e->call_stmt)
+ continue;
+
tree callee_fntype;
enum strub_mode callee_mode
= effective_strub_mode_for_call (e->call_stmt, &callee_fntype);
@@ -2480,6 +2496,9 @@ pass_ipa_strub::adjust_at_calls_calls (cgraph_node *node)
{
gcc_checking_assert (!e->indirect_unknown_callee);
+ if (!e->call_stmt)
+ continue;
+
tree callee_fntype;
enum strub_mode callee_mode
= effective_strub_mode_for_call (e->call_stmt, &callee_fntype);
@@ -3283,6 +3302,9 @@ pass_ipa_strub::execute (function *)
|| is_stdarg || apply_args)
for (cgraph_edge *e = nnode->callees, *enext; e; e = enext)
{
+ if (!e->call_stmt)
+ continue;
+
gcall *call = e->call_stmt;
gimple_stmt_iterator gsi = gsi_for_stmt (call);
tree fndecl = e->callee->decl;
^ permalink raw reply [flat|nested] 7+ messages in thread
* [gcc(refs/users/aoliva/heads/testme)] [strub] tolerate call_stmt-less cgraph_edges
@ 2023-06-09 6:18 Alexandre Oliva
0 siblings, 0 replies; 7+ messages in thread
From: Alexandre Oliva @ 2023-06-09 6:18 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:88546c1d5326c907a9e38cd574423812c720f84a
commit 88546c1d5326c907a9e38cd574423812c720f84a
Author: Alexandre Oliva <oliva@adacore.com>
Date: Thu Jun 8 01:44:03 2023 -0300
[strub] tolerate call_stmt-less cgraph_edges
cgraph::analyze creates cgraph_edges without call_stmt for thunks.
Skip edges without a call_stmt all over.
for gcc/ChangeLog
* ipa-strub.cc (calls_builtin_apply_args_p): Check for NULL
call_stmt in cgraph_edges.
(called_directly_with_type_override_p): Likewise.
(can_strub_internally_p): Likewise.
(distinctify_node_type): Likewise.
(verify_strub): Likewise.
(pass_ipa_strub::adjust_at_calls_calls): Likewise.
(pass_ipa_strub::execute): Likewise.
(pass_ipa_strub::adjust_at_calls_call): Require a call_stmt.
Diff:
---
gcc/ipa-strub.cc | 28 +++++++++++++++++++++++++---
1 file changed, 25 insertions(+), 3 deletions(-)
diff --git a/gcc/ipa-strub.cc b/gcc/ipa-strub.cc
index d61b7e2e36e..5fc4fca550d 100644
--- a/gcc/ipa-strub.cc
+++ b/gcc/ipa-strub.cc
@@ -489,7 +489,9 @@ calls_builtin_apply_args_p (cgraph_node *node, bool report = false)
if (!report)
break;
- sorry_at (gimple_location (e->call_stmt),
+ sorry_at (e->call_stmt
+ ? gimple_location (e->call_stmt)
+ : DECL_SOURCE_LOCATION (node->decl),
"at-calls %<strub%> does not support call to %qD",
cdecl);
}
@@ -607,7 +609,7 @@ static bool
called_directly_with_type_override_p (cgraph_node *node, void *)
{
for (cgraph_edge *e = node->callers; e; e = e->next_caller)
- if (strub_call_fntype_override_p (e->call_stmt))
+ if (e->call_stmt && strub_call_fntype_override_p (e->call_stmt))
return true;
return false;
@@ -694,7 +696,9 @@ can_strub_internally_p (cgraph_node *node, bool report = false)
if (!report)
return result;
- sorry_at (gimple_location (e->call_stmt),
+ sorry_at (e->call_stmt
+ ? gimple_location (e->call_stmt)
+ : DECL_SOURCE_LOCATION (node->decl),
"%qD is not eligible for internal %<strub%> "
"because it calls %qD",
node->decl, cdecl);
@@ -1428,6 +1432,8 @@ distinctify_node_type (cgraph_node *node)
we'll adjust their fntypes then. */
for (cgraph_edge *e = node->callers; e; e = e->next_caller)
{
+ if (!e->call_stmt)
+ continue;
tree fnaddr = gimple_call_fn (e->call_stmt);
gcc_checking_assert (TREE_CODE (fnaddr) == ADDR_EXPR
&& TREE_OPERAND (fnaddr, 0) == node->decl);
@@ -1494,6 +1500,9 @@ verify_strub ()
{
gcc_checking_assert (e->indirect_unknown_callee);
+ if (!e->call_stmt)
+ continue;
+
enum strub_mode callee_mode
= effective_strub_mode_for_call (e->call_stmt, NULL);
@@ -1507,6 +1516,9 @@ verify_strub ()
{
gcc_checking_assert (!e->indirect_unknown_callee);
+ if (!e->call_stmt)
+ continue;
+
tree callee_fntype;
enum strub_mode callee_mode
= effective_strub_mode_for_call (e->call_stmt, &callee_fntype);
@@ -2282,6 +2294,7 @@ void
pass_ipa_strub::adjust_at_calls_call (cgraph_edge *e, int named_args,
tree callee_fntype)
{
+ gcc_checking_assert (e->call_stmt);
gcall *ocall = e->call_stmt;
gimple_stmt_iterator gsi = gsi_for_stmt (ocall);
@@ -2458,6 +2471,9 @@ pass_ipa_strub::adjust_at_calls_calls (cgraph_node *node)
{
gcc_checking_assert (e->indirect_unknown_callee);
+ if (!e->call_stmt)
+ continue;
+
tree callee_fntype;
enum strub_mode callee_mode
= effective_strub_mode_for_call (e->call_stmt, &callee_fntype);
@@ -2480,6 +2496,9 @@ pass_ipa_strub::adjust_at_calls_calls (cgraph_node *node)
{
gcc_checking_assert (!e->indirect_unknown_callee);
+ if (!e->call_stmt)
+ continue;
+
tree callee_fntype;
enum strub_mode callee_mode
= effective_strub_mode_for_call (e->call_stmt, &callee_fntype);
@@ -3283,6 +3302,9 @@ pass_ipa_strub::execute (function *)
|| is_stdarg || apply_args)
for (cgraph_edge *e = nnode->callees, *enext; e; e = enext)
{
+ if (!e->call_stmt)
+ continue;
+
gcall *call = e->call_stmt;
gimple_stmt_iterator gsi = gsi_for_stmt (call);
tree fndecl = e->callee->decl;
^ permalink raw reply [flat|nested] 7+ messages in thread
* [gcc(refs/users/aoliva/heads/testme)] [strub] tolerate call_stmt-less cgraph_edges
@ 2023-06-08 10:59 Alexandre Oliva
0 siblings, 0 replies; 7+ messages in thread
From: Alexandre Oliva @ 2023-06-08 10:59 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:ee0b72472022bdb4a796c1c1ec2d049496f12183
commit ee0b72472022bdb4a796c1c1ec2d049496f12183
Author: Alexandre Oliva <oliva@adacore.com>
Date: Thu Jun 8 01:43:13 2023 -0300
[strub] tolerate call_stmt-less cgraph_edges
cgraph::analyze creates cgraph_edges without call_stmt for thunks.
Skip edges without a call_stmt all over.
for gcc/ChangeLog
* ipa-strub.cc (calls_builtin_apply_args_p): Check for NULL
call_stmt in cgraph_edges.
(called_directly_with_type_override_p): Likewise.
(can_strub_internally_p): Likewise.
(distinctify_node_type): Likewise.
(verify_strub): Likewise.
(pass_ipa_strub::adjust_at_calls_calls): Likewise.
(pass_ipa_strub::execute): Likewise.
(pass_ipa_strub::adjust_at_calls_call): Require a call_stmt.
Diff:
---
gcc/ipa-strub.cc | 28 +++++++++++++++++++++++++---
1 file changed, 25 insertions(+), 3 deletions(-)
diff --git a/gcc/ipa-strub.cc b/gcc/ipa-strub.cc
index d61b7e2e36e..5fc4fca550d 100644
--- a/gcc/ipa-strub.cc
+++ b/gcc/ipa-strub.cc
@@ -489,7 +489,9 @@ calls_builtin_apply_args_p (cgraph_node *node, bool report = false)
if (!report)
break;
- sorry_at (gimple_location (e->call_stmt),
+ sorry_at (e->call_stmt
+ ? gimple_location (e->call_stmt)
+ : DECL_SOURCE_LOCATION (node->decl),
"at-calls %<strub%> does not support call to %qD",
cdecl);
}
@@ -607,7 +609,7 @@ static bool
called_directly_with_type_override_p (cgraph_node *node, void *)
{
for (cgraph_edge *e = node->callers; e; e = e->next_caller)
- if (strub_call_fntype_override_p (e->call_stmt))
+ if (e->call_stmt && strub_call_fntype_override_p (e->call_stmt))
return true;
return false;
@@ -694,7 +696,9 @@ can_strub_internally_p (cgraph_node *node, bool report = false)
if (!report)
return result;
- sorry_at (gimple_location (e->call_stmt),
+ sorry_at (e->call_stmt
+ ? gimple_location (e->call_stmt)
+ : DECL_SOURCE_LOCATION (node->decl),
"%qD is not eligible for internal %<strub%> "
"because it calls %qD",
node->decl, cdecl);
@@ -1428,6 +1432,8 @@ distinctify_node_type (cgraph_node *node)
we'll adjust their fntypes then. */
for (cgraph_edge *e = node->callers; e; e = e->next_caller)
{
+ if (!e->call_stmt)
+ continue;
tree fnaddr = gimple_call_fn (e->call_stmt);
gcc_checking_assert (TREE_CODE (fnaddr) == ADDR_EXPR
&& TREE_OPERAND (fnaddr, 0) == node->decl);
@@ -1494,6 +1500,9 @@ verify_strub ()
{
gcc_checking_assert (e->indirect_unknown_callee);
+ if (!e->call_stmt)
+ continue;
+
enum strub_mode callee_mode
= effective_strub_mode_for_call (e->call_stmt, NULL);
@@ -1507,6 +1516,9 @@ verify_strub ()
{
gcc_checking_assert (!e->indirect_unknown_callee);
+ if (!e->call_stmt)
+ continue;
+
tree callee_fntype;
enum strub_mode callee_mode
= effective_strub_mode_for_call (e->call_stmt, &callee_fntype);
@@ -2282,6 +2294,7 @@ void
pass_ipa_strub::adjust_at_calls_call (cgraph_edge *e, int named_args,
tree callee_fntype)
{
+ gcc_checking_assert (e->call_stmt);
gcall *ocall = e->call_stmt;
gimple_stmt_iterator gsi = gsi_for_stmt (ocall);
@@ -2458,6 +2471,9 @@ pass_ipa_strub::adjust_at_calls_calls (cgraph_node *node)
{
gcc_checking_assert (e->indirect_unknown_callee);
+ if (!e->call_stmt)
+ continue;
+
tree callee_fntype;
enum strub_mode callee_mode
= effective_strub_mode_for_call (e->call_stmt, &callee_fntype);
@@ -2480,6 +2496,9 @@ pass_ipa_strub::adjust_at_calls_calls (cgraph_node *node)
{
gcc_checking_assert (!e->indirect_unknown_callee);
+ if (!e->call_stmt)
+ continue;
+
tree callee_fntype;
enum strub_mode callee_mode
= effective_strub_mode_for_call (e->call_stmt, &callee_fntype);
@@ -3283,6 +3302,9 @@ pass_ipa_strub::execute (function *)
|| is_stdarg || apply_args)
for (cgraph_edge *e = nnode->callees, *enext; e; e = enext)
{
+ if (!e->call_stmt)
+ continue;
+
gcall *call = e->call_stmt;
gimple_stmt_iterator gsi = gsi_for_stmt (call);
tree fndecl = e->callee->decl;
^ permalink raw reply [flat|nested] 7+ messages in thread
* [gcc(refs/users/aoliva/heads/testme)] [strub] tolerate call_stmt-less cgraph_edges
@ 2023-06-08 10:44 Alexandre Oliva
0 siblings, 0 replies; 7+ messages in thread
From: Alexandre Oliva @ 2023-06-08 10:44 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:fa9110205846042e518a22d591d0ec92ff59d2ca
commit fa9110205846042e518a22d591d0ec92ff59d2ca
Author: Alexandre Oliva <oliva@adacore.com>
Date: Thu Jun 8 01:44:03 2023 -0300
[strub] tolerate call_stmt-less cgraph_edges
cgraph::analyze creates cgraph_edges without call_stmt for thunks.
Skip edges without a call_stmt all over.
for gcc/ChangeLog
* ipa-strub.cc (calls_builtin_apply_args_p): Check for NULL
call_stmt in cgraph_edges.
(called_directly_with_type_override_p): Likewise.
(can_strub_internally_p): Likewise.
(distinctify_node_type): Likewise.
(verify_strub): Likewise.
(pass_ipa_strub::adjust_at_calls_calls): Likewise.
(pass_ipa_strub::execute): Likewise.
(pass_ipa_strub::adjust_at_calls_call): Require a call_stmt.
Diff:
---
gcc/ipa-strub.cc | 28 +++++++++++++++++++++++++---
1 file changed, 25 insertions(+), 3 deletions(-)
diff --git a/gcc/ipa-strub.cc b/gcc/ipa-strub.cc
index d61b7e2e36e..5fc4fca550d 100644
--- a/gcc/ipa-strub.cc
+++ b/gcc/ipa-strub.cc
@@ -489,7 +489,9 @@ calls_builtin_apply_args_p (cgraph_node *node, bool report = false)
if (!report)
break;
- sorry_at (gimple_location (e->call_stmt),
+ sorry_at (e->call_stmt
+ ? gimple_location (e->call_stmt)
+ : DECL_SOURCE_LOCATION (node->decl),
"at-calls %<strub%> does not support call to %qD",
cdecl);
}
@@ -607,7 +609,7 @@ static bool
called_directly_with_type_override_p (cgraph_node *node, void *)
{
for (cgraph_edge *e = node->callers; e; e = e->next_caller)
- if (strub_call_fntype_override_p (e->call_stmt))
+ if (e->call_stmt && strub_call_fntype_override_p (e->call_stmt))
return true;
return false;
@@ -694,7 +696,9 @@ can_strub_internally_p (cgraph_node *node, bool report = false)
if (!report)
return result;
- sorry_at (gimple_location (e->call_stmt),
+ sorry_at (e->call_stmt
+ ? gimple_location (e->call_stmt)
+ : DECL_SOURCE_LOCATION (node->decl),
"%qD is not eligible for internal %<strub%> "
"because it calls %qD",
node->decl, cdecl);
@@ -1428,6 +1432,8 @@ distinctify_node_type (cgraph_node *node)
we'll adjust their fntypes then. */
for (cgraph_edge *e = node->callers; e; e = e->next_caller)
{
+ if (!e->call_stmt)
+ continue;
tree fnaddr = gimple_call_fn (e->call_stmt);
gcc_checking_assert (TREE_CODE (fnaddr) == ADDR_EXPR
&& TREE_OPERAND (fnaddr, 0) == node->decl);
@@ -1494,6 +1500,9 @@ verify_strub ()
{
gcc_checking_assert (e->indirect_unknown_callee);
+ if (!e->call_stmt)
+ continue;
+
enum strub_mode callee_mode
= effective_strub_mode_for_call (e->call_stmt, NULL);
@@ -1507,6 +1516,9 @@ verify_strub ()
{
gcc_checking_assert (!e->indirect_unknown_callee);
+ if (!e->call_stmt)
+ continue;
+
tree callee_fntype;
enum strub_mode callee_mode
= effective_strub_mode_for_call (e->call_stmt, &callee_fntype);
@@ -2282,6 +2294,7 @@ void
pass_ipa_strub::adjust_at_calls_call (cgraph_edge *e, int named_args,
tree callee_fntype)
{
+ gcc_checking_assert (e->call_stmt);
gcall *ocall = e->call_stmt;
gimple_stmt_iterator gsi = gsi_for_stmt (ocall);
@@ -2458,6 +2471,9 @@ pass_ipa_strub::adjust_at_calls_calls (cgraph_node *node)
{
gcc_checking_assert (e->indirect_unknown_callee);
+ if (!e->call_stmt)
+ continue;
+
tree callee_fntype;
enum strub_mode callee_mode
= effective_strub_mode_for_call (e->call_stmt, &callee_fntype);
@@ -2480,6 +2496,9 @@ pass_ipa_strub::adjust_at_calls_calls (cgraph_node *node)
{
gcc_checking_assert (!e->indirect_unknown_callee);
+ if (!e->call_stmt)
+ continue;
+
tree callee_fntype;
enum strub_mode callee_mode
= effective_strub_mode_for_call (e->call_stmt, &callee_fntype);
@@ -3283,6 +3302,9 @@ pass_ipa_strub::execute (function *)
|| is_stdarg || apply_args)
for (cgraph_edge *e = nnode->callees, *enext; e; e = enext)
{
+ if (!e->call_stmt)
+ continue;
+
gcall *call = e->call_stmt;
gimple_stmt_iterator gsi = gsi_for_stmt (call);
tree fndecl = e->callee->decl;
^ permalink raw reply [flat|nested] 7+ messages in thread
* [gcc(refs/users/aoliva/heads/testme)] [strub] tolerate call_stmt-less cgraph_edges
@ 2023-06-08 9:18 Alexandre Oliva
0 siblings, 0 replies; 7+ messages in thread
From: Alexandre Oliva @ 2023-06-08 9:18 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:ee0b72472022bdb4a796c1c1ec2d049496f12183
commit ee0b72472022bdb4a796c1c1ec2d049496f12183
Author: Alexandre Oliva <oliva@adacore.com>
Date: Thu Jun 8 01:43:13 2023 -0300
[strub] tolerate call_stmt-less cgraph_edges
cgraph::analyze creates cgraph_edges without call_stmt for thunks.
Skip edges without a call_stmt all over.
for gcc/ChangeLog
* ipa-strub.cc (calls_builtin_apply_args_p): Check for NULL
call_stmt in cgraph_edges.
(called_directly_with_type_override_p): Likewise.
(can_strub_internally_p): Likewise.
(distinctify_node_type): Likewise.
(verify_strub): Likewise.
(pass_ipa_strub::adjust_at_calls_calls): Likewise.
(pass_ipa_strub::execute): Likewise.
(pass_ipa_strub::adjust_at_calls_call): Require a call_stmt.
Diff:
---
gcc/ipa-strub.cc | 28 +++++++++++++++++++++++++---
1 file changed, 25 insertions(+), 3 deletions(-)
diff --git a/gcc/ipa-strub.cc b/gcc/ipa-strub.cc
index d61b7e2e36e..5fc4fca550d 100644
--- a/gcc/ipa-strub.cc
+++ b/gcc/ipa-strub.cc
@@ -489,7 +489,9 @@ calls_builtin_apply_args_p (cgraph_node *node, bool report = false)
if (!report)
break;
- sorry_at (gimple_location (e->call_stmt),
+ sorry_at (e->call_stmt
+ ? gimple_location (e->call_stmt)
+ : DECL_SOURCE_LOCATION (node->decl),
"at-calls %<strub%> does not support call to %qD",
cdecl);
}
@@ -607,7 +609,7 @@ static bool
called_directly_with_type_override_p (cgraph_node *node, void *)
{
for (cgraph_edge *e = node->callers; e; e = e->next_caller)
- if (strub_call_fntype_override_p (e->call_stmt))
+ if (e->call_stmt && strub_call_fntype_override_p (e->call_stmt))
return true;
return false;
@@ -694,7 +696,9 @@ can_strub_internally_p (cgraph_node *node, bool report = false)
if (!report)
return result;
- sorry_at (gimple_location (e->call_stmt),
+ sorry_at (e->call_stmt
+ ? gimple_location (e->call_stmt)
+ : DECL_SOURCE_LOCATION (node->decl),
"%qD is not eligible for internal %<strub%> "
"because it calls %qD",
node->decl, cdecl);
@@ -1428,6 +1432,8 @@ distinctify_node_type (cgraph_node *node)
we'll adjust their fntypes then. */
for (cgraph_edge *e = node->callers; e; e = e->next_caller)
{
+ if (!e->call_stmt)
+ continue;
tree fnaddr = gimple_call_fn (e->call_stmt);
gcc_checking_assert (TREE_CODE (fnaddr) == ADDR_EXPR
&& TREE_OPERAND (fnaddr, 0) == node->decl);
@@ -1494,6 +1500,9 @@ verify_strub ()
{
gcc_checking_assert (e->indirect_unknown_callee);
+ if (!e->call_stmt)
+ continue;
+
enum strub_mode callee_mode
= effective_strub_mode_for_call (e->call_stmt, NULL);
@@ -1507,6 +1516,9 @@ verify_strub ()
{
gcc_checking_assert (!e->indirect_unknown_callee);
+ if (!e->call_stmt)
+ continue;
+
tree callee_fntype;
enum strub_mode callee_mode
= effective_strub_mode_for_call (e->call_stmt, &callee_fntype);
@@ -2282,6 +2294,7 @@ void
pass_ipa_strub::adjust_at_calls_call (cgraph_edge *e, int named_args,
tree callee_fntype)
{
+ gcc_checking_assert (e->call_stmt);
gcall *ocall = e->call_stmt;
gimple_stmt_iterator gsi = gsi_for_stmt (ocall);
@@ -2458,6 +2471,9 @@ pass_ipa_strub::adjust_at_calls_calls (cgraph_node *node)
{
gcc_checking_assert (e->indirect_unknown_callee);
+ if (!e->call_stmt)
+ continue;
+
tree callee_fntype;
enum strub_mode callee_mode
= effective_strub_mode_for_call (e->call_stmt, &callee_fntype);
@@ -2480,6 +2496,9 @@ pass_ipa_strub::adjust_at_calls_calls (cgraph_node *node)
{
gcc_checking_assert (!e->indirect_unknown_callee);
+ if (!e->call_stmt)
+ continue;
+
tree callee_fntype;
enum strub_mode callee_mode
= effective_strub_mode_for_call (e->call_stmt, &callee_fntype);
@@ -3283,6 +3302,9 @@ pass_ipa_strub::execute (function *)
|| is_stdarg || apply_args)
for (cgraph_edge *e = nnode->callees, *enext; e; e = enext)
{
+ if (!e->call_stmt)
+ continue;
+
gcall *call = e->call_stmt;
gimple_stmt_iterator gsi = gsi_for_stmt (call);
tree fndecl = e->callee->decl;
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-06-09 8:08 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-08 4:48 [gcc(refs/users/aoliva/heads/testme)] [strub] tolerate call_stmt-less cgraph_edges Alexandre Oliva
2023-06-08 9:18 Alexandre Oliva
2023-06-08 10:44 Alexandre Oliva
2023-06-08 10:59 Alexandre Oliva
2023-06-09 6:18 Alexandre Oliva
2023-06-09 6:26 Alexandre Oliva
2023-06-09 8:08 Alexandre Oliva
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).