diff options
author | Richard Guenther <rguenther@suse.de> | 2011-06-30 14:03:25 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2011-06-30 14:03:25 +0000 |
commit | 1565af083011ebc0469a3df4f93350ce1eecf20a (patch) | |
tree | 283d02d137114cb2d153800d6261b8ae89987166 /gcc/tree-ssa-structalias.c | |
parent | 42373e0b05c26d047925387d71fa833540dad8f0 (diff) | |
download | gcc-1565af083011ebc0469a3df4f93350ce1eecf20a.zip gcc-1565af083011ebc0469a3df4f93350ce1eecf20a.tar.gz gcc-1565af083011ebc0469a3df4f93350ce1eecf20a.tar.bz2 |
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
Diffstat (limited to 'gcc/tree-ssa-structalias.c')
-rw-r--r-- | gcc/tree-ssa-structalias.c | 90 |
1 files changed, 58 insertions, 32 deletions
diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c index dba8b01..6a9732f 100644 --- a/gcc/tree-ssa-structalias.c +++ b/gcc/tree-ssa-structalias.c @@ -5450,6 +5450,9 @@ create_variable_info_for (tree decl, const char *name) insert_vi_for_tree (decl, vi); + if (TREE_CODE (decl) != VAR_DECL) + return id; + /* Create initial constraints for globals. */ for (; vi; vi = vi->next) { @@ -5463,37 +5466,44 @@ create_variable_info_for (tree decl, const char *name) || vi->only_restrict_pointers) 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 - || DECL_EXTERNAL (decl) || TREE_PUBLIC (decl)) + || DECL_HARD_REGISTER (decl)) make_copy_constraint (vi, nonlocal_id); - /* If this is a global variable with an initializer and we are in - 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)) + else { - 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.type = SCALAR; - FOR_EACH_VEC_ELT (ce_s, rhsc, i, rhsp) - process_constraint (new_constraint (lhs, *rhsp)); - /* If this is a variable that escapes from the unit - the initializer escapes as well. */ - if (DECL_EXTERNAL (decl) || TREE_PUBLIC (decl)) + struct varpool_node *vnode = varpool_get_node (decl); + + /* For escaped variables initialize them from nonlocal. */ + if (!varpool_all_refs_explicit_p (vnode)) + make_copy_constraint (vi, nonlocal_id); + + /* If this is a global variable with an initializer and we are in + IPA mode generate constraints for it. */ + if (DECL_INITIAL (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.type = SCALAR; FOR_EACH_VEC_ELT (ce_s, rhsc, i, 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) varinfo_t vi; tree heapvar = build_fake_var_decl (TREE_TYPE (TREE_TYPE (t))); 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.type = SCALAR; lhsc.offset = 0; @@ -5566,6 +5577,13 @@ intra_create_variable_infos (void) rhsc.offset = 0; process_constraint (new_constraint (lhsc, rhsc)); 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; } @@ -6744,6 +6762,12 @@ ipa_pta_execute (void) init_alias_vars (); + if (dump_file && (dump_flags & TDF_DETAILS)) + { + dump_cgraph (dump_file); + fprintf (dump_file, "\n"); + } + /* Build the constraints. */ for (node = cgraph_nodes; node; node = node->next) { @@ -6751,10 +6775,11 @@ ipa_pta_execute (void) /* Nodes without a body are not interesting. Especially do not visit clones at this point for now - we get duplicate decls there for inline clones at least. */ - if (!cgraph_function_with_gimple_body_p (node) - || node->clone_of) + if (!cgraph_function_with_gimple_body_p (node)) continue; + gcc_assert (!node->clone_of); + vi = create_function_info_for (node->decl, alias_get_name (node->decl)); cgraph_for_node_and_aliases (node, associate_varinfo_to_alias, vi, true); @@ -6785,8 +6810,7 @@ ipa_pta_execute (void) tree old_func_decl; /* Nodes without a body are not interesting. */ - if (!cgraph_function_with_gimple_body_p (node) - || node->clone_of) + if (!cgraph_function_with_gimple_body_p (node)) continue; if (dump_file) @@ -6804,11 +6828,14 @@ ipa_pta_execute (void) push_cfun (func); 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 (); /* We also need to make function return values escape. Nothing @@ -6894,8 +6921,7 @@ ipa_pta_execute (void) struct cgraph_edge *e; /* Nodes without a body are not interesting. */ - if (!cgraph_function_with_gimple_body_p (node) - || node->clone_of) + if (!cgraph_function_with_gimple_body_p (node)) continue; fn = DECL_STRUCT_FUNCTION (node->decl); |