Commit 1565af08 by Richard Guenther Committed by Richard Biener

opts.c (finish_options): Do not disable IPA-PTA during ltrans.

2011-06-30  Richard Guenther  <rguenther@suse.de>

	* opts.c (finish_options): Do not disable IPA-PTA during ltrans.
	* tree-ssa-structalias.c (create_variable_info_for): Do not
	add initial constraints for non-var-decls.  Properly handle
	globals in other ltrans partitions.
	(intra_create_variable_infos): Manually create constraints for
	the fake no-alias parameter.
	(ipa_pta_execute): Dump the cgraph, handle ltrans partitions properly
	and assert there are no clones.

From-SVN: r175707
parent 42373e0b
2011-06-30 Richard Guenther <rguenther@suse.de> 2011-06-30 Richard Guenther <rguenther@suse.de>
* opts.c (finish_options): Do not disable IPA-PTA during ltrans.
* tree-ssa-structalias.c (create_variable_info_for): Do not
add initial constraints for non-var-decls. Properly handle
globals in other ltrans partitions.
(intra_create_variable_infos): Manually create constraints for
the fake no-alias parameter.
(ipa_pta_execute): Dump the cgraph, handle ltrans partitions properly
and assert there are no clones.
2011-06-30 Richard Guenther <rguenther@suse.de>
PR tree-optimization/46787 PR tree-optimization/46787
* tree-data-ref.c (dr_address_invariant_p): Remove. * tree-data-ref.c (dr_address_invariant_p): Remove.
(find_data_references_in_stmt): Invariant accesses are ok now. (find_data_references_in_stmt): Invariant accesses are ok now.
......
...@@ -766,11 +766,6 @@ finish_options (struct gcc_options *opts, struct gcc_options *opts_set, ...@@ -766,11 +766,6 @@ finish_options (struct gcc_options *opts, struct gcc_options *opts_set,
maybe_set_param_value (PARAM_STACK_FRAME_GROWTH, 40, maybe_set_param_value (PARAM_STACK_FRAME_GROWTH, 40,
opts->x_param_values, opts_set->x_param_values); opts->x_param_values, opts_set->x_param_values);
} }
if (opts->x_flag_wpa || opts->x_flag_ltrans)
{
/* These passes are not WHOPR compatible yet. */
opts->x_flag_ipa_pta = 0;
}
if (opts->x_flag_lto) if (opts->x_flag_lto)
{ {
......
...@@ -5450,6 +5450,9 @@ create_variable_info_for (tree decl, const char *name) ...@@ -5450,6 +5450,9 @@ create_variable_info_for (tree decl, const char *name)
insert_vi_for_tree (decl, vi); insert_vi_for_tree (decl, vi);
if (TREE_CODE (decl) != VAR_DECL)
return id;
/* Create initial constraints for globals. */ /* Create initial constraints for globals. */
for (; vi; vi = vi->next) for (; vi; vi = vi->next)
{ {
...@@ -5463,37 +5466,44 @@ create_variable_info_for (tree decl, const char *name) ...@@ -5463,37 +5466,44 @@ create_variable_info_for (tree decl, const char *name)
|| vi->only_restrict_pointers) || vi->only_restrict_pointers)
make_constraint_from_restrict (vi, "GLOBAL_RESTRICT"); make_constraint_from_restrict (vi, "GLOBAL_RESTRICT");
/* For escaped variables initialize them from nonlocal. */ /* In non-IPA mode the initializer from nonlocal is all we need. */
if (!in_ipa_mode if (!in_ipa_mode
|| DECL_EXTERNAL (decl) || TREE_PUBLIC (decl)) || DECL_HARD_REGISTER (decl))
make_copy_constraint (vi, nonlocal_id); make_copy_constraint (vi, nonlocal_id);
/* If this is a global variable with an initializer and we are in else
IPA mode generate constraints for it. In non-IPA mode
the initializer from nonlocal is all we need. */
if (in_ipa_mode
&& DECL_INITIAL (decl))
{ {
VEC (ce_s, heap) *rhsc = NULL; struct varpool_node *vnode = varpool_get_node (decl);
struct constraint_expr lhs, *rhsp;
unsigned i; /* For escaped variables initialize them from nonlocal. */
get_constraint_for_rhs (DECL_INITIAL (decl), &rhsc); if (!varpool_all_refs_explicit_p (vnode))
lhs.var = vi->id; make_copy_constraint (vi, nonlocal_id);
lhs.offset = 0;
lhs.type = SCALAR; /* If this is a global variable with an initializer and we are in
FOR_EACH_VEC_ELT (ce_s, rhsc, i, rhsp) IPA mode generate constraints for it. */
process_constraint (new_constraint (lhs, *rhsp)); if (DECL_INITIAL (decl))
/* If this is a variable that escapes from the unit
the initializer escapes as well. */
if (DECL_EXTERNAL (decl) || TREE_PUBLIC (decl))
{ {
lhs.var = escaped_id; VEC (ce_s, heap) *rhsc = NULL;
struct constraint_expr lhs, *rhsp;
unsigned i;
get_constraint_for_rhs (DECL_INITIAL (decl), &rhsc);
lhs.var = vi->id;
lhs.offset = 0; lhs.offset = 0;
lhs.type = SCALAR; lhs.type = SCALAR;
FOR_EACH_VEC_ELT (ce_s, rhsc, i, rhsp) FOR_EACH_VEC_ELT (ce_s, rhsc, i, rhsp)
process_constraint (new_constraint (lhs, *rhsp)); process_constraint (new_constraint (lhs, *rhsp));
/* If this is a variable that escapes from the unit
the initializer escapes as well. */
if (!varpool_all_refs_explicit_p (vnode))
{
lhs.var = escaped_id;
lhs.offset = 0;
lhs.type = SCALAR;
FOR_EACH_VEC_ELT (ce_s, rhsc, i, rhsp)
process_constraint (new_constraint (lhs, *rhsp));
}
VEC_free (ce_s, heap, rhsc);
} }
VEC_free (ce_s, heap, rhsc);
} }
} }
...@@ -5557,7 +5567,8 @@ intra_create_variable_infos (void) ...@@ -5557,7 +5567,8 @@ intra_create_variable_infos (void)
varinfo_t vi; varinfo_t vi;
tree heapvar = build_fake_var_decl (TREE_TYPE (TREE_TYPE (t))); tree heapvar = build_fake_var_decl (TREE_TYPE (TREE_TYPE (t)));
DECL_EXTERNAL (heapvar) = 1; DECL_EXTERNAL (heapvar) = 1;
vi = get_varinfo (create_variable_info_for (heapvar, "PARM_NOALIAS")); vi = create_variable_info_for_1 (heapvar, "PARM_NOALIAS");
insert_vi_for_tree (heapvar, vi);
lhsc.var = get_vi_for_tree (t)->id; lhsc.var = get_vi_for_tree (t)->id;
lhsc.type = SCALAR; lhsc.type = SCALAR;
lhsc.offset = 0; lhsc.offset = 0;
...@@ -5566,6 +5577,13 @@ intra_create_variable_infos (void) ...@@ -5566,6 +5577,13 @@ intra_create_variable_infos (void)
rhsc.offset = 0; rhsc.offset = 0;
process_constraint (new_constraint (lhsc, rhsc)); process_constraint (new_constraint (lhsc, rhsc));
vi->is_restrict_var = 1; vi->is_restrict_var = 1;
for (; vi; vi = vi->next)
if (vi->may_have_pointers)
{
if (vi->only_restrict_pointers)
make_constraint_from_restrict (vi, "GLOBAL_RESTRICT");
make_copy_constraint (vi, nonlocal_id);
}
continue; continue;
} }
...@@ -6744,6 +6762,12 @@ ipa_pta_execute (void) ...@@ -6744,6 +6762,12 @@ ipa_pta_execute (void)
init_alias_vars (); init_alias_vars ();
if (dump_file && (dump_flags & TDF_DETAILS))
{
dump_cgraph (dump_file);
fprintf (dump_file, "\n");
}
/* Build the constraints. */ /* Build the constraints. */
for (node = cgraph_nodes; node; node = node->next) for (node = cgraph_nodes; node; node = node->next)
{ {
...@@ -6751,10 +6775,11 @@ ipa_pta_execute (void) ...@@ -6751,10 +6775,11 @@ ipa_pta_execute (void)
/* Nodes without a body are not interesting. Especially do not /* Nodes without a body are not interesting. Especially do not
visit clones at this point for now - we get duplicate decls visit clones at this point for now - we get duplicate decls
there for inline clones at least. */ there for inline clones at least. */
if (!cgraph_function_with_gimple_body_p (node) if (!cgraph_function_with_gimple_body_p (node))
|| node->clone_of)
continue; continue;
gcc_assert (!node->clone_of);
vi = create_function_info_for (node->decl, vi = create_function_info_for (node->decl,
alias_get_name (node->decl)); alias_get_name (node->decl));
cgraph_for_node_and_aliases (node, associate_varinfo_to_alias, vi, true); cgraph_for_node_and_aliases (node, associate_varinfo_to_alias, vi, true);
...@@ -6785,8 +6810,7 @@ ipa_pta_execute (void) ...@@ -6785,8 +6810,7 @@ ipa_pta_execute (void)
tree old_func_decl; tree old_func_decl;
/* Nodes without a body are not interesting. */ /* Nodes without a body are not interesting. */
if (!cgraph_function_with_gimple_body_p (node) if (!cgraph_function_with_gimple_body_p (node))
|| node->clone_of)
continue; continue;
if (dump_file) if (dump_file)
...@@ -6804,11 +6828,14 @@ ipa_pta_execute (void) ...@@ -6804,11 +6828,14 @@ ipa_pta_execute (void)
push_cfun (func); push_cfun (func);
current_function_decl = node->decl; current_function_decl = node->decl;
if (node->local.externally_visible) /* For externally visible or attribute used annotated functions use
local constraints for their arguments.
For local functions we see all callers and thus do not need initial
constraints for parameters. */
if (node->reachable_from_other_partition
|| node->local.externally_visible
|| node->needed)
{ {
/* For externally visible functions use local constraints for
their arguments. For local functions we see all callers
and thus do not need initial constraints for parameters. */
intra_create_variable_infos (); intra_create_variable_infos ();
/* We also need to make function return values escape. Nothing /* We also need to make function return values escape. Nothing
...@@ -6894,8 +6921,7 @@ ipa_pta_execute (void) ...@@ -6894,8 +6921,7 @@ ipa_pta_execute (void)
struct cgraph_edge *e; struct cgraph_edge *e;
/* Nodes without a body are not interesting. */ /* Nodes without a body are not interesting. */
if (!cgraph_function_with_gimple_body_p (node) if (!cgraph_function_with_gimple_body_p (node))
|| node->clone_of)
continue; continue;
fn = DECL_STRUCT_FUNCTION (node->decl); fn = DECL_STRUCT_FUNCTION (node->decl);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment