Comments
Patch
@@ -4319,6 +4319,9 @@ ipa_tm_create_version_alias (struct cgraph_node *node, void *data)
record_tm_clone_pair (old_decl, new_decl);
+ /* If someone refers to this function indirectly, mark it needed */
+ if (ipa_ref_list_first_refering (&info->old_node->ref_list))
+ ipa_tm_mark_needed_node (info->old_node);
if (info->old_node->needed)
ipa_tm_mark_needed_node (new_node);
return false;
@@ -4372,6 +4375,10 @@ ipa_tm_create_version (struct cgraph_node *old_node)
record_tm_clone_pair (old_decl, new_decl);
cgraph_call_function_insertion_hooks (new_node);
+ /* If someone refers to this function indirectly, mark it needed */
+ if (ipa_ref_list_first_refering (&old_node->ref_list))
+ ipa_tm_mark_needed_node (old_node);
+
if (old_node->needed)
ipa_tm_mark_needed_node (new_node);
@@ -4778,8 +4785,13 @@ ipa_tm_execute (void)
No need to do this if the function's address can't be taken. */
if (is_tm_pure (node->decl))
{
- if (!node->local.local)
+ if (!node->local.local) {
record_tm_clone_pair (node->decl, node->decl);
+ /* if someone refers to this function other than as a call,
+ mark it needed */
+ if (ipa_ref_list_first_refering (&node->ref_list))
+ ipa_tm_mark_needed_node (node);
+ }
continue;
}