Hi,
this is the third version of this patch (v2:
https://gcc.gnu.org/pipermail/gcc-patches/2025-December/702508.html).
I changed set_new_clone_decl_and_node_flags to set local to true iff
there are no references to the new node, which is not the case for
callback clones. The flag has to be set this way as there is no
way to tell what value will new_node->local have at that point. I
removed the callback_called_p method from cgraph_node, as it now serves
no purpose. Bootstrapped and regtested on x86_64-linux with
RUNTESTFLAGS="--target_board='unix{-m32}'", it fixes the PR regressions
and introduces no new regressions. This patch also fixes 2 tests in
gcc.dg/guality/vla-1.c when testing with --target_board='unix{-m32}'. I
am not quite sure why.
Best regards,
Josef
PR ipa/122798
gcc/ChangeLog:
* cgraph.cc (cgraph_edge::redirect_callee): Set address_taken
for new callee.
* cgraphclones.cc (set_new_clone_decl_and_node_flags): Set
node->local to true iff there are no references to it.
Signed-off-by: Josef Melcr <[email protected]>
---
gcc/cgraph.cc | 1 +
gcc/cgraphclones.cc | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/gcc/cgraph.cc b/gcc/cgraph.cc
index 3c21e174943..d6811b19544 100644
--- a/gcc/cgraph.cc
+++ b/gcc/cgraph.cc
@@ -1698,6 +1698,7 @@ cgraph_edge::redirect_callee (cgraph_node *n)
new_ref->lto_stmt_uid = lto_stmt_uid;
if (!old_callee->referred_to_p ())
old_callee->address_taken = 0;
+ n->mark_address_taken ();
}
if (!inline_failed)
diff --git a/gcc/cgraphclones.cc b/gcc/cgraphclones.cc
index 49f0e58fa1e..276dd525536 100644
--- a/gcc/cgraphclones.cc
+++ b/gcc/cgraphclones.cc
@@ -176,7 +176,7 @@ set_new_clone_decl_and_node_flags (cgraph_node *new_node)
DECL_IS_REPLACEABLE_OPERATOR (new_node->decl) = 0;
new_node->externally_visible = 0;
- new_node->local = 1;
+ new_node->local = !new_node->referred_to_p ();
new_node->lowered = true;
new_node->semantic_interposition = 0;
}
--
2.52.0