summaryrefslogtreecommitdiff
path: root/gcc/ipa-cp.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ipa-cp.c')
-rw-r--r--gcc/ipa-cp.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c
index f7782cbbf83..59a051915f6 100644
--- a/gcc/ipa-cp.c
+++ b/gcc/ipa-cp.c
@@ -442,7 +442,7 @@ ipcp_cloning_candidate_p (struct cgraph_node *node)
FIXME: in future we should clone such functions when they are called with
different constants, but current ipcp implementation is not good on this.
*/
- if (!node->needed || !node->analyzed)
+ if (cgraph_only_called_directly_p (node) || !node->analyzed)
return false;
if (cgraph_function_body_availability (node) <= AVAIL_OVERWRITABLE)
@@ -536,7 +536,7 @@ ipcp_initialize_node_lattices (struct cgraph_node *node)
if (ipa_is_called_with_var_arguments (info))
type = IPA_BOTTOM;
- else if (!node->needed)
+ else if (cgraph_only_called_directly_p (node))
type = IPA_TOP;
/* When cloning is allowed, we can assume that externally visible functions
are not called. We will compensate this by cloning later. */
@@ -954,7 +954,7 @@ ipcp_estimate_growth (struct cgraph_node *node)
struct cgraph_edge *cs;
int redirectable_node_callers = 0;
int removable_args = 0;
- bool need_original = node->needed;
+ bool need_original = !cgraph_only_called_directly_p (node);
struct ipa_node_params *info;
int i, count;
int growth;
@@ -1143,7 +1143,7 @@ ipcp_insert_stage (void)
for (cs = node->callers; cs != NULL; cs = cs->next_caller)
if (cs->caller == node || ipcp_need_redirect_p (cs))
break;
- if (!cs && !node->needed)
+ if (!cs && cgraph_only_called_directly_p (node))
bitmap_set_bit (dead_nodes, node->uid);
info = IPA_NODE_REF (node);
@@ -1273,7 +1273,13 @@ ipcp_generate_summary (void)
static bool
cgraph_gate_cp (void)
{
- return flag_ipa_cp;
+ /* FIXME lto. IPA-CP does not tolerate running when the inlining decisions
+ have not been applied. This happens when WPA modifies the callgraph.
+ Since those decisions are not applied until after all the IPA passes
+ have been run in LTRANS, this means that IPA passes may see partially
+ modified callgraphs. The solution to this is to apply WPA decisions
+ early during LTRANS. */
+ return flag_ipa_cp && !flag_ltrans;
}
struct ipa_opt_pass_d pass_ipa_cp =