summaryrefslogtreecommitdiff
path: root/gcc/ipa-cp.c
diff options
context:
space:
mode:
authorjamborm <jamborm@138bc75d-0d04-0410-961f-82ee72b054a4>2008-07-17 13:23:32 +0000
committerjamborm <jamborm@138bc75d-0d04-0410-961f-82ee72b054a4>2008-07-17 13:23:32 +0000
commit86c96e3a40e9600d6e9e5fd87dac5afb55961eaf (patch)
treefbd54fb05da1736f1ad2c36f9e38e2f0ad726075 /gcc/ipa-cp.c
parent19f42ddfb72faef8a936fbfe4d700aa0871794c1 (diff)
downloadgcc-86c96e3a40e9600d6e9e5fd87dac5afb55961eaf.tar.gz
2008-07-17 Martin Jambor <mjambor@suse.cz>
* ipa-cp.c (ipcp_print_all_lattices): New variable info, check that nodes are relevant by examining the node->analyzed flag. (ipcp_init_stage): Check which nodes are relevant, assert that the relevant ones are also required. (ipcp_propagate_stage): Check on the side arrays are properly allocated. (ipcp_print_all_jump_functions): Make sure not to touch any node that is not analyzed or an edge that does not have a corresponding entry in the on-the-side vectors. (ipcp_function_scale_print): Likewise. (ipcp_update_callgraph): Check that the node is relevant. (ipcp_insert_stage): Check that the node is relevant. Check there is an info for every node and edge. * ipa-prop.c (ipa_init_func_list): Check the nodes are relevant. (ipa_print_all_tree_maps): Likewise and a new variable info. (ipa_print_all_params_modified): Likewise. * ipa-prop.h (ipa_edge_args_info_available_for_edge_p): New function. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@137921 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ipa-cp.c')
-rw-r--r--gcc/ipa-cp.c41
1 files changed, 33 insertions, 8 deletions
diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c
index bda0fc261d6..505f17d101c 100644
--- a/gcc/ipa-cp.c
+++ b/gcc/ipa-cp.c
@@ -293,7 +293,11 @@ ipcp_print_all_lattices (FILE * f)
fprintf (f, "\nLATTICE PRINT\n");
for (node = cgraph_nodes; node; node = node->next)
{
- struct ipa_node_params *info = IPA_NODE_REF (node);
+ struct ipa_node_params *info;
+
+ if (!node->analyzed)
+ continue;
+ info = IPA_NODE_REF (node);
fprintf (f, "Printing lattices %s:\n", cgraph_node_name (node));
count = ipa_get_param_count (info);
for (i = 0; i < count; i++)
@@ -413,6 +417,11 @@ ipcp_init_stage (void)
for (node = cgraph_nodes; node; node = node->next)
{
+ if (!node->analyzed)
+ continue;
+ /* Unreachable nodes should have been eliminated before ipcp. */
+ gcc_assert (node->needed || node->reachable);
+
ipa_count_formal_params (node);
ipa_create_param_decls_array (node);
ipcp_initialize_node_lattices (node);
@@ -421,9 +430,13 @@ ipcp_init_stage (void)
}
for (node = cgraph_nodes; node; node = node->next)
{
+ if (!node->analyzed)
+ continue;
/* building jump functions */
for (cs = node->callees; cs; cs = cs->next_callee)
{
+ if (!cs->callee->analyzed)
+ continue;
ipa_count_arguments (cs);
if (ipa_get_cs_argument_count (IPA_EDGE_REF (cs))
!= ipa_get_param_count (IPA_NODE_REF (cs->callee)))
@@ -480,6 +493,8 @@ ipcp_propagate_stage (void)
struct ipa_func_list *wl;
int count;
+ ipa_check_create_node_params ();
+ ipa_check_create_edge_args ();
/* Initialize worklist to contain all functions. */
wl = ipa_init_func_list ();
while (wl)
@@ -550,12 +565,16 @@ ipcp_print_all_jump_functions (FILE * f)
fprintf (f, "\nCALLSITE PARAM PRINT\n");
for (node = cgraph_nodes; node; node = node->next)
{
+ if (!node->analyzed)
+ continue;
+
for (cs = node->callees; cs; cs = cs->next_callee)
{
fprintf (f, "callsite %s ", cgraph_node_name (node));
fprintf (f, "-> %s :: \n", cgraph_node_name (cs->callee));
- if (ipa_is_called_with_var_arguments (IPA_NODE_REF (cs->callee)))
+ if (!ipa_edge_args_info_available_for_edge_p (cs)
+ || ipa_is_called_with_var_arguments (IPA_NODE_REF (cs->callee)))
continue;
count = ipa_get_cs_argument_count (IPA_EDGE_REF (cs));
@@ -592,6 +611,8 @@ ipcp_function_scale_print (FILE * f)
for (node = cgraph_nodes; node; node = node->next)
{
+ if (!node->analyzed)
+ continue;
fprintf (f, "printing scale for %s: ", cgraph_node_name (node));
fprintf (f, "value is " HOST_WIDE_INT_PRINT_DEC
" \n", (HOST_WIDE_INT) ipcp_get_node_scale (node));
@@ -820,7 +841,7 @@ ipcp_update_callgraph (void)
for (node = cgraph_nodes; node; node = node->next)
{
/* want to fix only original nodes */
- if (ipcp_node_is_clone (node))
+ if (!node->analyzed || ipcp_node_is_clone (node))
continue;
for (cs = node->callees; cs; cs = cs->next_callee)
if (ipcp_node_is_clone (cs->callee))
@@ -906,13 +927,17 @@ ipcp_insert_stage (void)
tree parm_tree;
struct ipa_replace_map *replace_param;
+ ipa_check_create_node_params ();
+ ipa_check_create_edge_args ();
+
for (node = cgraph_nodes; node; node = node->next)
{
- struct ipa_node_params *info = IPA_NODE_REF (node);
- /* Propagation of the constant is forbidden in
- certain conditions. */
- if (!node->analyzed || ipcp_node_not_modifiable_p (node)
- || ipa_is_called_with_var_arguments (info))
+ struct ipa_node_params *info;
+ /* Propagation of the constant is forbidden in certain conditions. */
+ if (!node->analyzed || ipcp_node_not_modifiable_p (node))
+ continue;
+ info = IPA_NODE_REF (node);
+ if (ipa_is_called_with_var_arguments (info))
continue;
const_param = 0;
count = ipa_get_param_count (info);