aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.8/gcc/ipa-prop.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.8/gcc/ipa-prop.c')
-rw-r--r--gcc-4.8/gcc/ipa-prop.c64
1 files changed, 27 insertions, 37 deletions
diff --git a/gcc-4.8/gcc/ipa-prop.c b/gcc-4.8/gcc/ipa-prop.c
index c62dc68a2..41aec2feb 100644
--- a/gcc-4.8/gcc/ipa-prop.c
+++ b/gcc-4.8/gcc/ipa-prop.c
@@ -623,16 +623,22 @@ parm_preserved_before_stmt_p (struct param_analysis_info *parm_ainfo,
if (parm_ainfo && parm_ainfo->parm_modified)
return false;
+ if (optimize)
+ {
gcc_checking_assert (gimple_vuse (stmt) != NULL_TREE);
ao_ref_init (&refd, parm_load);
- /* We can cache visited statements only when parm_ainfo is available and when
- we are looking at a naked load of the whole parameter. */
+ /* We can cache visited statements only when parm_ainfo is available and
+ when we are looking at a naked load of the whole parameter. */
if (!parm_ainfo || TREE_CODE (parm_load) != PARM_DECL)
visited_stmts = NULL;
else
visited_stmts = &parm_ainfo->parm_visited_statements;
walk_aliased_vdefs (&refd, gimple_vuse (stmt), mark_modified, &modified,
visited_stmts);
+ }
+ else
+ modified = true;
+
if (parm_ainfo && modified)
parm_ainfo->parm_modified = true;
return !modified;
@@ -740,7 +746,7 @@ static bool
ipa_load_from_parm_agg_1 (vec<ipa_param_descriptor_t> descriptors,
struct param_analysis_info *parms_ainfo, gimple stmt,
tree op, int *index_p, HOST_WIDE_INT *offset_p,
- bool *by_ref_p)
+ HOST_WIDE_INT *size_p, bool *by_ref_p)
{
int index;
HOST_WIDE_INT size, max_size;
@@ -758,6 +764,8 @@ ipa_load_from_parm_agg_1 (vec<ipa_param_descriptor_t> descriptors,
{
*index_p = index;
*by_ref_p = false;
+ if (size_p)
+ *size_p = size;
return true;
}
return false;
@@ -800,6 +808,8 @@ ipa_load_from_parm_agg_1 (vec<ipa_param_descriptor_t> descriptors,
{
*index_p = index;
*by_ref_p = true;
+ if (size_p)
+ *size_p = size;
return true;
}
return false;
@@ -814,7 +824,7 @@ ipa_load_from_parm_agg (struct ipa_node_params *info, gimple stmt,
bool *by_ref_p)
{
return ipa_load_from_parm_agg_1 (info->descriptors, NULL, stmt, op, index_p,
- offset_p, by_ref_p);
+ offset_p, NULL, by_ref_p);
}
/* Given that an actual argument is an SSA_NAME (given in NAME) and is a result
@@ -1051,7 +1061,8 @@ compute_complex_ancestor_jump_func (struct ipa_node_params *info,
return;
parm = TREE_OPERAND (expr, 0);
index = ipa_get_param_decl_index (info, SSA_NAME_VAR (parm));
- gcc_assert (index >= 0);
+ if (index < 0)
+ return;
cond_bb = single_pred (assign_bb);
cond = last_stmt (cond_bb);
@@ -1462,6 +1473,9 @@ ipa_compute_jump_functions (struct cgraph_node *node,
{
struct cgraph_edge *cs;
+ if (!optimize)
+ return;
+
for (cs = node->callees; cs; cs = cs->next_callee)
{
struct cgraph_node *callee = cgraph_function_or_thunk_node (cs->callee,
@@ -1646,7 +1660,7 @@ ipa_analyze_indirect_call_uses (struct cgraph_node *node,
if (gimple_assign_single_p (def)
&& ipa_load_from_parm_agg_1 (info->descriptors, parms_ainfo, def,
gimple_assign_rhs1 (def), &index, &offset,
- &by_ref))
+ NULL, &by_ref))
{
struct cgraph_edge *cs = ipa_note_param_call (node, index, call);
cs->indirect_info->offset = offset;
@@ -1847,8 +1861,7 @@ ipa_analyze_stmt_uses (struct cgraph_node *node, struct ipa_node_params *info,
passed in DATA. */
static bool
-visit_ref_for_mod_analysis (gimple stmt ATTRIBUTE_UNUSED,
- tree op, void *data)
+visit_ref_for_mod_analysis (gimple, tree op, tree, void *data)
{
struct ipa_node_params *info = (struct ipa_node_params *) data;
@@ -2126,7 +2139,6 @@ ipa_make_edge_direct_to_target (struct cgraph_edge *ie, tree target)
we may create the first reference to the object in the unit. */
if (!callee || callee->global.inlined_to)
{
- struct cgraph_node *first_clone = callee;
/* We are better to ensure we can refer to it.
In the case of static functions we are out of luck, since we already
@@ -2142,31 +2154,7 @@ ipa_make_edge_direct_to_target (struct cgraph_edge *ie, tree target)
xstrdup (cgraph_node_name (ie->callee)), ie->callee->uid);
return NULL;
}
-
- /* Create symbol table node. Even if inline clone exists, we can not take
- it as a target of non-inlined call. */
- callee = cgraph_create_node (target);
-
- /* OK, we previously inlined the function, then removed the offline copy and
- now we want it back for external call. This can happen when devirtualizing
- while inlining function called once that happens after extern inlined and
- virtuals are already removed. In this case introduce the external node
- and make it available for call. */
- if (first_clone)
- {
- first_clone->clone_of = callee;
- callee->clones = first_clone;
- symtab_prevail_in_asm_name_hash ((symtab_node)callee);
- symtab_insert_node_to_hashtable ((symtab_node)callee);
- if (dump_file)
- fprintf (dump_file, "ipa-prop: Introduced new external node "
- "(%s/%i) and turned into root of the clone tree.\n",
- xstrdup (cgraph_node_name (callee)), callee->uid);
- }
- else if (dump_file)
- fprintf (dump_file, "ipa-prop: Introduced new external node "
- "(%s/%i).\n",
- xstrdup (cgraph_node_name (callee)), callee->uid);
+ callee = cgraph_get_create_real_symbol_node (target);
}
ipa_check_create_node_params ();
@@ -3902,7 +3890,7 @@ ipcp_transform_function (struct cgraph_node *node)
struct ipa_agg_replacement_value *v;
gimple stmt = gsi_stmt (gsi);
tree rhs, val, t;
- HOST_WIDE_INT offset;
+ HOST_WIDE_INT offset, size;
int index;
bool by_ref, vce;
@@ -3929,13 +3917,15 @@ ipcp_transform_function (struct cgraph_node *node)
continue;
if (!ipa_load_from_parm_agg_1 (descriptors, parms_ainfo, stmt,
- rhs, &index, &offset, &by_ref))
+ rhs, &index, &offset, &size, &by_ref))
continue;
for (v = aggval; v; v = v->next)
if (v->index == index
&& v->offset == offset)
break;
- if (!v || v->by_ref != by_ref)
+ if (!v
+ || v->by_ref != by_ref
+ || tree_low_cst (TYPE_SIZE (TREE_TYPE (v->value)), 0) != size)
continue;
gcc_checking_assert (is_gimple_ip_invariant (v->value));