aboutsummaryrefslogtreecommitdiff
path: root/gcc/cgraph.cc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2023-02-22 11:22:03 +0100
committerJakub Jelinek <jakub@redhat.com>2023-02-22 11:22:03 +0100
commitfb5365907317551cf9e4661aa78dd4f773e7a18a (patch)
tree93f8f5aff3ec71e7efd5d84832540407e7435a9d /gcc/cgraph.cc
parent334f23d83261997ca89d8919b94b97aa22003a65 (diff)
downloadgcc-fb5365907317551cf9e4661aa78dd4f773e7a18a.zip
gcc-fb5365907317551cf9e4661aa78dd4f773e7a18a.tar.gz
gcc-fb5365907317551cf9e4661aa78dd4f773e7a18a.tar.bz2
cgraph: Handle BUILT_IN_UNREACHABLE_TRAP like BUILT_IN_UNREACHABLE in more spots [PR106258]
The following testcase ICEs because we still have some spots that treat BUILT_IN_UNREACHABLE specially but not BUILT_IN_UNREACHABLE_TRAP the same. 2023-02-22 Jakub Jelinek <jakub@redhat.com> PR middle-end/106258 * cgraph.cc (cgraph_edge::redirect_call_stmt_to_callee, cgraph_update_edges_for_call_stmt_node, cgraph_node::verify_node): Handle BUILT_IN_UNREACHABLE_TRAP like BUILT_IN_UNREACHABLE. * cgraphclones.cc (cgraph_node::create_clone): Likewise. * g++.dg/ipa/pr106258.C: New test.
Diffstat (limited to 'gcc/cgraph.cc')
-rw-r--r--gcc/cgraph.cc11
1 files changed, 8 insertions, 3 deletions
diff --git a/gcc/cgraph.cc b/gcc/cgraph.cc
index f352212..ec663d2 100644
--- a/gcc/cgraph.cc
+++ b/gcc/cgraph.cc
@@ -1548,7 +1548,8 @@ cgraph_edge::redirect_call_stmt_to_callee (cgraph_edge *e)
else
{
if (flag_checking
- && !fndecl_built_in_p (e->callee->decl, BUILT_IN_UNREACHABLE))
+ && !fndecl_built_in_p (e->callee->decl, BUILT_IN_UNREACHABLE)
+ && !fndecl_built_in_p (e->callee->decl, BUILT_IN_UNREACHABLE_TRAP))
ipa_verify_edge_has_no_modifications (e);
new_stmt = e->call_stmt;
gimple_call_set_fndecl (new_stmt, e->callee->decl);
@@ -1634,7 +1635,9 @@ cgraph_update_edges_for_call_stmt_node (cgraph_node *node,
{
/* Keep calls marked as dead dead. */
if (new_stmt && is_gimple_call (new_stmt) && e->callee
- && fndecl_built_in_p (e->callee->decl, BUILT_IN_UNREACHABLE))
+ && (fndecl_built_in_p (e->callee->decl, BUILT_IN_UNREACHABLE)
+ || fndecl_built_in_p (e->callee->decl,
+ BUILT_IN_UNREACHABLE_TRAP)))
{
cgraph_edge::set_call_stmt (node->get_edge (old_stmt),
as_a <gcall *> (new_stmt));
@@ -3598,7 +3601,9 @@ cgraph_node::verify_node (void)
/* Optimized out calls are redirected to __builtin_unreachable. */
&& (e->count.nonzero_p ()
|| ! e->callee->decl
- || !fndecl_built_in_p (e->callee->decl, BUILT_IN_UNREACHABLE))
+ || !(fndecl_built_in_p (e->callee->decl, BUILT_IN_UNREACHABLE)
+ || fndecl_built_in_p (e->callee->decl,
+ BUILT_IN_UNREACHABLE_TRAP)))
&& count
== ENTRY_BLOCK_PTR_FOR_FN (DECL_STRUCT_FUNCTION (decl))->count
&& (!e->count.ipa_p ()