===================================================================
@@ -407,11 +407,13 @@ get_base_var (tree t)
/* SRC and DST are going to be merged. Take SRC's profile and merge it into
- DST so it is not going to be lost. Destroy SRC's body on the way. */
+ DST so it is not going to be lost. Possibly destroy SRC's body on the way
+ unless PRESERVE_BODY is set. */
void
ipa_merge_profiles (struct cgraph_node *dst,
- struct cgraph_node *src)
+ struct cgraph_node *src,
+ bool preserve_body)
{
tree oldsrcdecl = src->decl;
struct function *srccfun, *dstcfun;
@@ -652,7 +654,8 @@ ipa_merge_profiles (struct cgraph_node *
e->frequency = freq;
}
}
- src->release_body ();
+ if (!preserve_body)
+ src->release_body ();
inline_update_overall_summary (dst);
}
/* TODO: if there is no match, we can scale up. */
===================================================================
@@ -762,7 +762,7 @@ sem_function::merge (sem_item *alias_ite
}
alias->icf_merged = true;
- ipa_merge_profiles (local_original, alias);
+ ipa_merge_profiles (local_original, alias, true);
alias->create_wrapper (local_original);
if (dump_file)
===================================================================
@@ -44,7 +44,7 @@ bool ipa_edge_within_scc (struct cgraph_
int ipa_reverse_postorder (struct cgraph_node **);
tree get_base_var (tree);
void ipa_merge_profiles (struct cgraph_node *dst,
- struct cgraph_node *src);
+ struct cgraph_node *src, bool preserve_body = false);
bool recursive_call_p (tree, tree);
/* In ipa-profile.c */