Commit 310bc633 by Martin Jambor Committed by Martin Jambor

ipa-prop.h: Include alloc-pool.h, all sorts of updates to general comments.

2011-07-18  Martin Jambor  <mjambor@suse.cz>

	* ipa-prop.h: Include alloc-pool.h, all sorts of updates to general
	comments.
	(ipcp_values_pool): Declare.
	(ipcp_sources_pool): Likewise.
	(ipcp_lattice): Changed to forward declaration.
	(ipa_param_descriptor): Removed fields ipcp_lattice, types and
	cannot_devirtualize.
	(ipa_node_params): New fields descriptors, lattices, known_vals,
	clone_for_all_contexts and node dead, removed fields params and
	count_scale.
	(ipa_set_param_count): Removed.
	(ipa_get_param_count): Made to work with descriptors vector.
	(ipa_get_param): Updated.
	(ipa_param_cannot_devirtualize_p): Removed.
	(ipa_param_types_vec_empty): Likewise.
	(ipa_set_param_used): New function.
	(ipa_get_param_used): Updated to use descriptors vector.
	(ipa_func_list): Removed.
	(ipa_init_func_list): Removed declaration.
	(ipa_push_func_to_list_1): Likewise.
	(ipa_pop_func_from_list): Likewise.
	(ipa_push_func_to_list): Removed.
	(ipa_lattice_from_jfunc): Remove declaration.
	(ipa_get_jf_pass_through_result): Declare.
	(ipa_get_jf_ancestor_result): Likewise.
	(ipa_value_from_jfunc): Likewise.
	(ipa_get_lattice): Update.
	(ipa_lat_is_single_const): New function.
	* ipa-prop.c (ipa_push_func_to_list_1): Removed.
	(ipa_init_func_list): Likewise.
	(ipa_pop_func_from_list): Likewise.
	(ipa_get_param_decl_index): Fix coding style.
	(count_formal_params): Removed.
	(count_formal_params_1): Renamed to count_formal_params.
	(ipa_populate_param_decls): Update to use descriptors vector.
	(ipa_initialize_node_params): Likewise.
	(visit_ref_for_mod_analysis): Use ipa_set_param_used.
	(ipa_analyze_params_uses): Likewise.
	(ipa_free_node_params_substructures): Likewise and free also lattices
	and known values.
	(duplicate_array): Removed.
	(ipa_edge_duplication_hook): Add the new edge to the list of edge
	clones.
	(ipa_node_duplication_hook): Update to use new lattices.
	(ipa_free_all_structures_after_ipa_cp): Free alloc pools.
	(ipa_free_all_structures_after_iinln): Likewise.
	(ipa_write_node_info): Update to use new lattices.
	(ipa_read_node_info): Likewise.
	(ipa_get_jf_pass_through_result): New function.
	(ipa_get_jf_ancestor_result): Likewise.
	(ipa_value_from_jfunc): Likewise.
	(ipa_cst_from_jfunc): Reimplemented using ipa_value_from_jfunc.
	* ipa-cp.c: Reimplemented.
	* params.def (PARAM_DEVIRT_TYPE_LIST_SIZE): Removed.
	(PARAM_IPA_CP_VALUE_LIST_SIZE): New parameter.
	(PARAM_IPA_CP_EVAL_THRESHOLD): Likewise.
	* Makefile.in (IPA_PROP_H): Added alloc-pool.h to dependencies.

	* doc/invoke.texi (devirt-type-list-size): Removed description.
	(ipa-cp-value-list-size): Added description.

	* testsuite/gcc.dg/ipa/ipa-1.c: Updated testcase dump scan.
	* testsuite/gcc.dg/ipa/ipa-2.c: Likewise.
	* testsuite/gcc.dg/ipa/ipa-3.c: Likewise and made functions static.
	* testsuite/gcc.dg/ipa/ipa-4.c: Updated testcase dump scan.
	* testsuite/gcc.dg/ipa/ipa-5.c: Likewise.
	* testsuite/gcc.dg/ipa/ipa-7.c: Likewise.
	* testsuite/gcc.dg/ipa/ipa-8.c: Updated testcase dump scan.
	* testsuite/gcc.dg/ipa/ipacost-1.c: Likewise.
	* testsuite/gcc.dg/ipa/ipacost-2.c: Likewise and increased sizes
	of some functions.
	* testsuite/gcc.dg/ipa/ipcp-1.c: New test.
	* testsuite/gcc.dg/ipa/ipcp-2.c: Likewise.
	* testsuite/gcc.dg/tree-ssa/ipa-cp-1.c: Updated testcase.

From-SVN: r176424
parent ca176e1c
2011-07-18 Martin Jambor <mjambor@suse.cz>
* ipa-prop.h: Include alloc-pool.h, all sorts of updates to general
comments.
(ipcp_values_pool): Declare.
(ipcp_sources_pool): Likewise.
(ipcp_lattice): Changed to forward declaration.
(ipa_param_descriptor): Removed fields ipcp_lattice, types and
cannot_devirtualize.
(ipa_node_params): New fields descriptors, lattices, known_vals,
clone_for_all_contexts and node dead, removed fields params and
count_scale.
(ipa_set_param_count): Removed.
(ipa_get_param_count): Made to work with descriptors vector.
(ipa_get_param): Updated.
(ipa_param_cannot_devirtualize_p): Removed.
(ipa_param_types_vec_empty): Likewise.
(ipa_set_param_used): New function.
(ipa_get_param_used): Updated to use descriptors vector.
(ipa_func_list): Removed.
(ipa_init_func_list): Removed declaration.
(ipa_push_func_to_list_1): Likewise.
(ipa_pop_func_from_list): Likewise.
(ipa_push_func_to_list): Removed.
(ipa_lattice_from_jfunc): Remove declaration.
(ipa_get_jf_pass_through_result): Declare.
(ipa_get_jf_ancestor_result): Likewise.
(ipa_value_from_jfunc): Likewise.
(ipa_get_lattice): Update.
(ipa_lat_is_single_const): New function.
* ipa-prop.c (ipa_push_func_to_list_1): Removed.
(ipa_init_func_list): Likewise.
(ipa_pop_func_from_list): Likewise.
(ipa_get_param_decl_index): Fix coding style.
(count_formal_params): Removed.
(count_formal_params_1): Renamed to count_formal_params.
(ipa_populate_param_decls): Update to use descriptors vector.
(ipa_initialize_node_params): Likewise.
(visit_ref_for_mod_analysis): Use ipa_set_param_used.
(ipa_analyze_params_uses): Likewise.
(ipa_free_node_params_substructures): Likewise and free also lattices
and known values.
(duplicate_array): Removed.
(ipa_edge_duplication_hook): Add the new edge to the list of edge
clones.
(ipa_node_duplication_hook): Update to use new lattices.
(ipa_free_all_structures_after_ipa_cp): Free alloc pools.
(ipa_free_all_structures_after_iinln): Likewise.
(ipa_write_node_info): Update to use new lattices.
(ipa_read_node_info): Likewise.
(ipa_get_jf_pass_through_result): New function.
(ipa_get_jf_ancestor_result): Likewise.
(ipa_value_from_jfunc): Likewise.
(ipa_cst_from_jfunc): Reimplemented using ipa_value_from_jfunc.
* ipa-cp.c: Reimplemented.
* params.def (PARAM_DEVIRT_TYPE_LIST_SIZE): Removed.
(PARAM_IPA_CP_VALUE_LIST_SIZE): New parameter.
(PARAM_IPA_CP_EVAL_THRESHOLD): Likewise.
* Makefile.in (IPA_PROP_H): Added alloc-pool.h to dependencies.
* doc/invoke.texi (devirt-type-list-size): Removed description.
(ipa-cp-value-list-size): Added description.
2011-07-18 Richard Henderson <rth@redhat.com>
* bb-reorder.c (fix_crossing_conditional_branches): Emit all insns
......
......@@ -1006,7 +1006,7 @@ LTO_STREAMER_H = lto-streamer.h $(LINKER_PLUGIN_API_H) $(TARGET_H) \
$(CGRAPH_H) $(VEC_H) vecprim.h $(TREE_H) $(GIMPLE_H) \
$(GCOV_IO_H)
TREE_VECTORIZER_H = tree-vectorizer.h $(TREE_DATA_REF_H)
IPA_PROP_H = ipa-prop.h $(TREE_H) $(VEC_H) $(CGRAPH_H) $(GIMPLE_H)
IPA_PROP_H = ipa-prop.h $(TREE_H) $(VEC_H) $(CGRAPH_H) $(GIMPLE_H) alloc-pool.h
GSTAB_H = gstab.h stab.def
BITMAP_H = bitmap.h $(HASHTAB_H) statistics.h
GCC_PLUGIN_H = gcc-plugin.h highlev-plugin-common.h $(CONFIG_H) $(SYSTEM_H) \
......
......@@ -9006,11 +9006,11 @@ loop in the loop nest by a given number of iterations. The strip
length can be changed using the @option{loop-block-tile-size}
parameter. The default value is 51 iterations.
@item devirt-type-list-size
IPA-CP attempts to track all possible types passed to a function's
parameter in order to perform devirtualization.
@option{devirt-type-list-size} is the maximum number of types it
stores per a single formal parameter of a function.
@item ipa-cp-value-list-size
IPA-CP attempts to track all possible values and types passed to a function's
parameter in order to propagate them and perform devirtualization.
@option{ipa-cp-value-list-size} is the maximum number of values and types it
stores per one formal parameter of a function.
@item lto-partitions
Specify desired number of partitions produced during WHOPR compilation.
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -860,12 +860,18 @@ DEFPARAM (PARAM_IPA_SRA_PTR_GROWTH_FACTOR,
"a pointer to an aggregate with",
2, 0, 0)
DEFPARAM (PARAM_DEVIRT_TYPE_LIST_SIZE,
"devirt-type-list-size",
"Maximum size of a type list associated with each parameter for "
"devirtualization",
DEFPARAM (PARAM_IPA_CP_VALUE_LIST_SIZE,
"ipa-cp-value-list-size",
"Maximum size of a list of values associated with each parameter for "
"interprocedural constant propagation",
8, 0, 0)
DEFPARAM (PARAM_IPA_CP_EVAL_THRESHOLD,
"ipa-cp-eval-threshold",
"Threshold ipa-cp opportunity evaluation that is still considered "
"beneficial to clone.",
500, 0, 0)
/* WHOPR partitioning configuration. */
DEFPARAM (PARAM_LTO_PARTITIONS,
......
2011-07-18 Martin Jambor <mjambor@suse.cz>
* gcc.dg/ipa/ipa-1.c: Updated testcase dump scan.
* gcc.dg/ipa/ipa-2.c: Likewise.
* gcc.dg/ipa/ipa-3.c: Likewise and made functions static.
* gcc.dg/ipa/ipa-4.c: Updated testcase dump scan.
* gcc.dg/ipa/ipa-5.c: Likewise.
* gcc.dg/ipa/ipa-7.c: Likewise.
* gcc.dg/ipa/ipa-8.c: Updated testcase dump scan.
* gcc.dg/ipa/ipacost-1.c: Likewise.
* gcc.dg/ipa/ipacost-2.c: Likewise and increased sizes of some
functions.
* gcc.dg/ipa/ipcp-1.c: New test.
* gcc.dg/ipa/ipcp-2.c: Likewise.
* gcc.dg/tree-ssa/ipa-cp-1.c: Updated testcase.
2011-07-18 Jakub Jelinek <jakub@redhat.com>
PR middle-end/49675
......
......@@ -24,9 +24,8 @@ int main ()
}
/* { dg-final { scan-ipa-dump-times "versioned function" 2 "cp" } } */
/* { dg-final { scan-ipa-dump "Creating a specialized node of f" "cp" } } */
/* { dg-final { scan-ipa-dump "replacing param a with const 7" "cp" } } */
/* { dg-final { scan-ipa-dump "replacing param b with const 7" "cp" } } */
/* { dg-final { cleanup-ipa-dump "cp" } } */
......@@ -22,7 +22,6 @@ int main ()
}
/* { dg-final { scan-ipa-dump-times "versioned function" 2 "cp" } } */
/* { dg-final { scan-ipa-dump "Creating a specialized node of f" "cp" } } */
/* { dg-final { scan-ipa-dump "replacing param a with const 7" "cp" } } */
/* { dg-final { scan-ipa-dump "replacing param c with const 3" "cp" } } */
/* { dg-final { cleanup-ipa-dump "cp" } } */
......@@ -7,12 +7,12 @@
#include <stdio.h>
void t(void);
int g (double b, double c)
static int g (double b, double c)
{
t();
return (int)(b+c);
}
int f (double a)
static int f (double a)
{
if (a > 0)
g (a, 3.1);
......@@ -28,8 +28,9 @@ int main ()
}
/* { dg-final { scan-ipa-dump-times "versioned function" 2 "cp" } } */
/* { dg-final { scan-ipa-dump "Creating a specialized node of f" "cp" } } */
/* { dg-final { scan-ipa-dump "replacing param a with const 7" "cp" } } */
/* { dg-final { scan-ipa-dump "Creating a specialized node of g" "cp" } } */
/* { dg-final { scan-ipa-dump "replacing param b with const 7" "cp" } } */
/* { dg-final { scan-ipa-dump "replacing param c with const 3" "cp" } } */
/* { dg-final { cleanup-ipa-dump "cp" } } */
......@@ -25,6 +25,6 @@ int main ()
}
/* { dg-final { scan-ipa-dump-times "versioned function" 1 "cp" } } */
/* { dg-final { scan-ipa-dump "Creating a specialized node of f" "cp" } } */
/* { dg-final { scan-ipa-dump-times "replacing param a with const 7" 1 "cp" } } */
/* { dg-final { cleanup-ipa-dump "cp" } } */
......@@ -26,8 +26,7 @@ int main ()
return 0;
}
/* { dg-final { scan-ipa-dump-times "versioned function" 2 "cp" } } */
/* { dg-final { scan-ipa-dump-times "Creating a specialized node" 2 "cp" } } */
/* { dg-final { scan-ipa-dump "replacing param c with const 3" "cp" } } */
/* { dg-final { scan-ipa-dump "replacing param a with const 7" "cp" } } */
/* { dg-final { cleanup-ipa-dump "cp" } } */
......@@ -26,8 +26,8 @@ int main ()
}
/* { dg-final { scan-ipa-dump-times "versioned function" 1 "cp" } } */
/* { dg-final { scan-ipa-dump-times "replacing param a with const 7" 1 "cp" } } */
/* { dg-final { scan-ipa-dump "Creating a specialized node of f" "cp" } } */
/* { dg-final { scan-ipa-dump-times "replacing param . with const 7" 1 "cp" } } */
/* { dg-final { cleanup-ipa-dump "cp" } } */
......@@ -22,8 +22,9 @@ int main ()
}
/* { dg-final { scan-ipa-dump-times "versioned function" 2 "cp" } } */
/* { dg-final { scan-ipa-dump "Creating a specialized node of f" "cp" } } */
/* { dg-final { scan-ipa-dump "replacing param a with const 7" "cp" } } */
/* { dg-final { scan-ipa-dump "Creating a specialized node of g" "cp" } } */
/* { dg-final { scan-ipa-dump "replacing param b with const 7" "cp" } } */
/* { dg-final { cleanup-ipa-dump "cp" } } */
......
......@@ -51,10 +51,10 @@ main()
i_can_not_be_propagated_fully2 (array);
}
/* { dg-final { scan-ipa-dump-times "versioned function i_can_be_propagated_fully2" 1 "cp" } } */
/* { dg-final { scan-ipa-dump-times "versioned function i_can_be_propagated_fully " 1 "cp" } } */
/* { dg-final { scan-ipa-dump-not "versioned function i_can_not_be_propagated_fully2" "cp" } } */
/* { dg-final { scan-ipa-dump-not "versioned function i_can_not_be_propagated_fully " "cp" } } */
/* { dg-final { scan-ipa-dump-times "Creating a specialized node of i_can_be_propagated_fully2" 1 "cp" } } */
/* { dg-final { scan-ipa-dump-times "Creating a specialized node of i_can_be_propagated_fully/" 1 "cp" } } */
/* { dg-final { scan-ipa-dump-not "Creating a specialized node of i_can_not_be_propagated_fully2" "cp" } } */
/* { dg-final { scan-ipa-dump-not "Creating a specialized node of i_can_not_be_propagated_fully/" "cp" } } */
/* { dg-final { scan-tree-dump-not "i_can_be_propagated_fully " "optimized" } } */
/* { dg-final { scan-tree-dump-not "i_can_be_propagated_fully2 " "optimized" } } */
/* { dg-final { cleanup-ipa-dump "cp" } } */
......
......@@ -40,8 +40,23 @@ i_can_not_be_propagated_fully (int *a)
int
i_can_not_be_propagated_fully2 (int *a)
{
int i;
i_can_not_be_propagated_fully (a);
for (i=0;i<50;i++)
{
t(a[i] + 1);
t(a[i+1] + 1);
t(a[i+2] + 1);
t(a[i+3] + 1);
}
i_can_not_be_propagated_fully (a);
for (i=0;i<50;i++)
{
t(a[i] + 2);
t(a[i+1] + 2);
t(a[i+2] + 2);
t(a[i+3] + 2);
}
i_can_not_be_propagated_fully (a);
}
main()
......@@ -50,15 +65,15 @@ main()
i_can_be_propagated_fully2 (array);
i_can_be_propagated_fully2 (array);
for (i = 0; i < 100; i++)
for (i = 0; i < 7; i++)
i_can_not_be_propagated_fully2 (array);
i_can_not_be_propagated_fully2 (array);
}
/* { dg-final { scan-ipa-dump-times "versioned function i_can_be_propagated_fully2" 1 "cp" } } */
/* { dg-final { scan-ipa-dump-times "versioned function i_can_be_propagated_fully " 1 "cp" } } */
/* { dg-final { scan-ipa-dump-times "versioned function i_can_not_be_propagated_fully2" 1 "cp" } } */
/* { dg-final { scan-ipa-dump-times "versioned function i_can_not_be_propagated_fully " 1 "cp" } } */
/* { dg-final { scan-ipa-dump-times "Creating a specialized node of i_can_be_propagated_fully2" 1 "cp" } } */
/* { dg-final { scan-ipa-dump-times "Creating a specialized node of i_can_be_propagated_fully/" 1 "cp" } } */
/* { dg-final { scan-ipa-dump-not "Creating a specialized node of i_can_not_be_propagated_fully2" "cp" } } */
/* { dg-final { scan-ipa-dump-not "Creating a specialized node of i_can_not_be_propagated_fully/" "cp" } } */
/* { dg-final { scan-tree-dump-not "i_can_be_propagated_fully \\(" "optimized" } } */
/* { dg-final { scan-tree-dump-not "i_can_be_propagated_fully2 \\(" "optimized" } } */
/* { dg-final { cleanup-ipa-dump "cp" } } */
......
/* Test that IPA-CP is able to figure out that poth parameters a are constant 7
even though f and h recursively call each other and specialize them
accordinly. */
/* { dg-do compile } */
/* { dg-options "-O3 -fipa-cp -fipa-cp-clone -fdump-ipa-cp -fno-early-inlining" } */
/* { dg-add-options bind_pic_locally } */
extern void use_stuff (int);
static
int g (int b, int c)
{
int i;
for (i = 0; i < b; i++)
use_stuff (c);
}
static void f (int a, int x, int z);
static void h (int z, int a)
{
use_stuff (z);
f (a, 9, 10);
}
static void
f (int a, int x, int z)
{
if (z > 1)
g (a, x);
else
h (5, a);
}
int
main (int argc, char *argv[])
{
int i;
for (i = 0; i < 100; i++)
f (7, 8, argc);
return 0;
}
/* { dg-final { scan-ipa-dump "Creating a specialized node of f.*for all known contexts" "cp" } } */
/* { dg-final { scan-ipa-dump "replacing param a with const 7" "cp" } } */
/* { dg-final { cleanup-ipa-dump "cp" } } */
/* { dg-do compile } */
/* { dg-options "-O3 -fipa-cp -fipa-cp-clone -fdump-ipa-cp -fno-early-inlining" } */
/* { dg-add-options bind_pic_locally } */
extern int get_stuff (int);
extern void do_stuff (int);
extern void do_stuff2 (int);
extern void do_other_stuff (void);
extern int get_element (int, int, int);
extern int adjust (int, int, int, int);
extern int count;
int
foo (int s, int p)
{
int c, r = 0;
for (c = 0 ; c < count; c++)
{
r += get_stuff (s);
/* The following is just something big that can go away. */
if (p != 0)
{
int a[64][64];
int i, j, k;
for (i = 0; i < 64; i++)
for (j = 0; j < 64; j++)
a[i][j] = get_element (p + c, i, j);
for (k = 0; k < 4; k++)
{
r = r / 2;
for (i = 1; i < 63; i++)
for (j = 62; j > 0; j--)
a[i][j] += adjust (a[i-1][j], a[i][j-1],
a[i+1][j], a[i][j+1]);
for (i = 4; i < 64; i += 4)
for (j = 4; j < 64; j += 4)
r += a[i][j] / 4;
}
}
}
return r;
}
int
bar (int p, int q)
{
if (q > 0)
do_stuff (q);
else
do_stuff (-q);
if (q % 2)
do_stuff2 (2 * q);
else
do_stuff2 (2 * (q + 1));
return foo (4, p);
}
int
bah (int p, int q)
{
int i, j;
while (q < -20)
q += get_stuff (-q);
for (i = 0; i < 36; i++)
for (j = 0; j < 36; j++)
do_stuff (get_stuff (q * i + 2));
bar (p, q);
}
int
top1 (int q)
{
do_other_stuff ();
return bah (0, q);
}
int
top2 (int q)
{
do_stuff (200);
do_other_stuff ();
return bah (16, q);
}
/* { dg-final { scan-ipa-dump-times "Creating a specialized node of foo" 1 "cp" } } */
/* { dg-final { scan-ipa-dump-times "replacing param p with const 0" 3 "cp" } } */
/* { dg-final { scan-ipa-dump "replacing param s with const 4" "cp" } } */
/* { dg-final { cleanup-ipa-dump "cp" } } */
......@@ -5,9 +5,13 @@
int
very_long_function(int a)
{
return very_long_function (a)/4;
if (a > 0)
return 2 * a + very_long_function (a)/4;
else
return 2 * -a + very_long_function (a)/4;
}
main()
blah ()
{
very_long_function (1);
}
......
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