Commit 062c604f by Martin Jambor Committed by Martin Jambor

ipa-prop.h (struct ipa_param_descriptor): Removed the modified flag.

2010-06-25  Martin Jambor  <mjambor@suse.cz>

	* ipa-prop.h (struct ipa_param_descriptor): Removed the modified flag.
	(struct ipa_node_params): Removed the modification_analysis_done flag.
	(ipa_is_param_modified): Removed.
	(ipa_analyze_node): Declare.
	(ipa_compute_jump_functions): Remove declaration.
	(ipa_count_arguments): Likewise.
	(ipa_detect_param_modifications): Likewise.
	(ipa_analyze_params_uses): Likewise.
	* ipa-prop.c (struct param_analysis_info): New type.
	(visit_store_addr_for_mod_analysis): Removed.
	(visit_load_for_mod_analysis): Renamed to visit_ref_for_mod_analysis,
	moved down in the file.
	(ipa_detect_param_modifications): Merged into ipa_analyze_params_uses.
	(ipa_count_arguments): Made static.
	(mark_modified): New function.
	(is_parm_modified_before_call): New function.
	(compute_pass_through_member_ptrs): New parameter parms_info, call
	is_parm_modified_before_call instead of ipa_is_param_modified.
	(ipa_compute_jump_functions_for_edge): New parameter parms_info, pass
	it to compute_pass_through_member_ptrs.
	(ipa_compute_jump_functions): New parameter parms_info, pass it to
	ipa_compute_jump_functions_for_edge.  Call ipa_initialize_node_params
	on the callee if it is analyzed.  Made static.
	(ipa_analyze_indirect_call_uses): New parameter parms_info, call
	is_parm_modified_before_call instead of ipa_is_param_modified.
	(ipa_analyze_call_uses): New parameter parms_info, pass it to
	ipa_analyze_indirect_call_uses.
	(ipa_analyze_stmt_uses): New parameter parms_info, pass it to
	ipa_analyze_call_uses.
	(ipa_analyze_params_uses): New parameter parms_info, pass it to
	ipa_analyze_stmt_uses.  Also perform the used analysis.  Made static.
	(ipa_analyze_node): New function.
	(ipa_print_node_params): Do not dump the modified flag.
	(ipa_write_node_info): Assert uses_analysis_done rather than streaming
	it.  Do not stream the modified parameter flag.
	(ipa_read_node_info): Set uses_analysis_done to 1 instead of streaming
	it.  Do not stream the modified parameter flag.
	* ipa-cp.c (ipcp_analyze_node): Removed.
	(ipcp_init_stage): Iterate only once over the nodes, analyze each one
	with only a call to ipa_analyze_node.
	* ipa-inline.c (inline_indirect_intraprocedural_analysis): Analyze the
	node with only a call to ipa_analyze_node.
	
	* testsuite/g++.dg/ipa/iinline-3.C: New test.
	* testsuite/gcc.dg/ipa/modif-1.c: Removed.

From-SVN: r161384
parent 212580ff
2010-06-25 Martin Jambor <mjambor@suse.cz>
* ipa-prop.h (struct ipa_param_descriptor): Removed the modified flag.
(struct ipa_node_params): Removed the modification_analysis_done flag.
(ipa_is_param_modified): Removed.
(ipa_analyze_node): Declare.
(ipa_compute_jump_functions): Remove declaration.
(ipa_count_arguments): Likewise.
(ipa_detect_param_modifications): Likewise.
(ipa_analyze_params_uses): Likewise.
* ipa-prop.c (struct param_analysis_info): New type.
(visit_store_addr_for_mod_analysis): Removed.
(visit_load_for_mod_analysis): Renamed to visit_ref_for_mod_analysis,
moved down in the file.
(ipa_detect_param_modifications): Merged into ipa_analyze_params_uses.
(ipa_count_arguments): Made static.
(mark_modified): New function.
(is_parm_modified_before_call): New function.
(compute_pass_through_member_ptrs): New parameter parms_info, call
is_parm_modified_before_call instead of ipa_is_param_modified.
(ipa_compute_jump_functions_for_edge): New parameter parms_info, pass
it to compute_pass_through_member_ptrs.
(ipa_compute_jump_functions): New parameter parms_info, pass it to
ipa_compute_jump_functions_for_edge. Call ipa_initialize_node_params
on the callee if it is analyzed. Made static.
(ipa_analyze_indirect_call_uses): New parameter parms_info, call
is_parm_modified_before_call instead of ipa_is_param_modified.
(ipa_analyze_call_uses): New parameter parms_info, pass it to
ipa_analyze_indirect_call_uses.
(ipa_analyze_stmt_uses): New parameter parms_info, pass it to
ipa_analyze_call_uses.
(ipa_analyze_params_uses): New parameter parms_info, pass it to
ipa_analyze_stmt_uses. Also perform the used analysis. Made static.
(ipa_analyze_node): New function.
(ipa_print_node_params): Do not dump the modified flag.
(ipa_write_node_info): Assert uses_analysis_done rather than streaming
it. Do not stream the modified parameter flag.
(ipa_read_node_info): Set uses_analysis_done to 1 instead of streaming
it. Do not stream the modified parameter flag.
* ipa-cp.c (ipcp_analyze_node): Removed.
(ipcp_init_stage): Iterate only once over the nodes, analyze each one
with only a call to ipa_analyze_node.
* ipa-inline.c (inline_indirect_intraprocedural_analysis): Analyze the
node with only a call to ipa_analyze_node.
2010-06-25 Manuel López-Ibáñez <manu@gcc.gnu.org>
* doc/invoke.texi (-Wsuggest-attribute): Add item for noreturn.
......
......@@ -177,18 +177,6 @@ ipcp_init_cloned_node (struct cgraph_node *orig_node,
IPA_NODE_REF (new_node)->ipcp_orig_node = orig_node;
}
/* Perform intraprocedrual analysis needed for ipcp. */
static void
ipcp_analyze_node (struct cgraph_node *node)
{
/* Unreachable nodes should have been eliminated before ipcp. */
gcc_assert (node->needed || node->reachable);
node->local.versionable = tree_versionable_function_p (node->decl);
ipa_initialize_node_params (node);
ipa_detect_param_modifications (node);
}
/* Return scale for NODE. */
static inline gcov_type
ipcp_get_node_scale (struct cgraph_node *node)
......@@ -611,6 +599,7 @@ ipcp_compute_node_scale (struct cgraph_node *node)
/* Initialization and computation of IPCP data structures. This is the initial
intraprocedural analysis of functions, which gathers information to be
propagated later on. */
static void
ipcp_init_stage (void)
{
......@@ -618,16 +607,13 @@ ipcp_init_stage (void)
for (node = cgraph_nodes; node; node = node->next)
if (node->analyzed)
ipcp_analyze_node (node);
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_analyze_params_uses (node);
/* building jump functions */
ipa_compute_jump_functions (node);
}
node->local.versionable = tree_versionable_function_p (node->decl);
ipa_analyze_node (node);
}
}
/* Return true if there are some formal parameters whose value is IPA_TOP (in
......
......@@ -2011,12 +2011,8 @@ struct gimple_opt_pass pass_inline_parameters =
static void
inline_indirect_intraprocedural_analysis (struct cgraph_node *node)
{
ipa_initialize_node_params (node);
ipa_detect_param_modifications (node);
ipa_analyze_params_uses (node);
ipa_compute_jump_functions (node);
if (dump_file)
ipa_analyze_node (node);
if (dump_file && (dump_flags & TDF_DETAILS))
{
ipa_print_node_params (dump_file, node);
ipa_print_node_jump_functions (dump_file, node);
......
......@@ -161,8 +161,6 @@ struct ipa_param_descriptor
struct ipcp_lattice ipcp_lattice;
/* PARAM_DECL of this parameter. */
tree decl;
/* Whether the value parameter has been modified within the function. */
unsigned modified : 1;
/* The parameter is used. */
unsigned used : 1;
};
......@@ -179,8 +177,6 @@ struct ipa_node_params
/* Whether this function is called with variable number of actual
arguments. */
unsigned called_with_var_arguments : 1;
/* Whether the modification analysis has already been performed. */
unsigned modification_analysis_done : 1;
/* Whether the param uses analysis has already been performed. */
unsigned uses_analysis_done : 1;
/* Whether the function is enqueued in an ipa_func_list. */
......@@ -228,17 +224,6 @@ ipa_get_param (struct ipa_node_params *info, int i)
return info->params[i].decl;
}
/* Return the modification flag corresponding to the Ith formal parameter of
the function associated with INFO. Note that there is no setter method as
the goal is to set all flags when building the array in
ipa_detect_param_modifications. */
static inline bool
ipa_is_param_modified (struct ipa_node_params *info, int i)
{
return info->params[i].modified;
}
/* Return the used flag corresponding to the Ith formal parameter of
the function associated with INFO. */
......@@ -412,14 +397,10 @@ ipa_push_func_to_list (struct ipa_func_list **wl, struct cgraph_node *node)
ipa_push_func_to_list_1 (wl, node, info);
}
/* Callsite related calculations. */
void ipa_compute_jump_functions (struct cgraph_node *);
void ipa_count_arguments (struct cgraph_edge *);
void ipa_analyze_node (struct cgraph_node *);
/* Function formal parameters related computations. */
void ipa_initialize_node_params (struct cgraph_node *node);
void ipa_detect_param_modifications (struct cgraph_node *);
void ipa_analyze_params_uses (struct cgraph_node *);
bool ipa_propagate_indirect_call_infos (struct cgraph_edge *cs,
VEC (cgraph_edge_p, heap) **new_edges);
......
2010-06-25 Martin Jambor <mjambor@suse.cz>
* g++.dg/ipa/iinline-3.C: New test.
* gcc.dg/ipa/modif-1.c: Removed.
2010-06-25 Jan Hubicka <jh@suse.cz>
* testsuite/gcc.dg/tree-ssa/ipa-split-1.c
......
/* Verify that we do not indirect-inline using member pointer
parameters which have been modified. */
/* { dg-do run } */
/* { dg-options "-O3 -fno-early-inlining" } */
/* { dg-add-options bind_pic_locally } */
extern "C" void abort (void);
class String
{
private:
const char *data;
public:
String (const char *d) : data(d)
{}
int funcOne (int stuff) const;
int funcTwo (int stuff) const;
};
int String::funcOne (int stuff) const
{
return stuff + 1;
}
int String::funcTwo (int stuff) const
{
return stuff + 100;
}
int (String::* gmp)(int stuff) const = &String::funcTwo;
int docalling_1 (int (String::* f)(int stuff) const)
{
String S ("muhehehe");
return (S.*f)(4);
}
int docalling (int a, int (String::* f)(int stuff) const)
{
if (a < 200)
f = gmp;
return docalling_1 (f);
}
int __attribute__ ((noinline,noclone)) get_input (void)
{
return 1;
}
int main (int argc, char *argv[])
{
int i = 0;
while (i < 10)
i += docalling (get_input (), &String::funcOne);
if (i != 104)
abort();
return 0;
}
/* Verify that modification analysis detects modfications. */
/* { dg-do compile } */
/* { dg-options "-O3 -c -fdump-ipa-inline-details -fno-early-inlining" } */
struct whatever
{
int first;
unsigned second;
};
void func1 (struct whatever w);
void func2 (struct whatever *pw);
void func3 (int i);
void func4 (int *pi);
void the_test (struct whatever u, struct whatever v,
struct whatever w, struct whatever x,
int i, int k, int l)
{
struct whatever *pw = &w;
int *pk = &k;
v.first = 9;
func1 (u);
func1 (v);
func2 (pw);
func2 (&x);
func3 (i);
func4 (pk);
func4 (&l);
}
/* { dg-final { scan-ipa-dump-not "param 0\[^\\n\]*modified" "inline" } } */
/* { dg-final { scan-ipa-dump "param 1\[^\\n\]*modified" "inline" } } */
/* { dg-final { scan-ipa-dump "param 2\[^\\n\]*modified" "inline" } } */
/* { dg-final { scan-ipa-dump "param 3\[^\\n\]*modified" "inline" } } */
/* { dg-final { scan-ipa-dump-not "param 4\[^\\n\]*modified" "inline" } } */
/* { dg-final { scan-ipa-dump "param 5\[^\\n\]*modified" "inline" } } */
/* { dg-final { scan-ipa-dump "param 6\[^\\n\]*modified" "inline" } } */
/* { dg-final { cleanup-ipa-dump "inline" } } */
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