diff options
author | abel <abel@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-01-27 13:47:41 +0000 |
---|---|---|
committer | abel <abel@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-01-27 13:47:41 +0000 |
commit | c7af8ae71c5450921a79b29f1cec9d427cd3c975 (patch) | |
tree | 083a3f9c465c92d16c9531e2235042ab1fc90ad1 /gcc/tree-data-ref.c | |
parent | 3a19c06377e6f28b0328663107124aa0b98f7f44 (diff) | |
download | gcc-c7af8ae71c5450921a79b29f1cec9d427cd3c975.tar.gz |
PR middle-end/51389
* Makefile.in (tree-data-ref.o): Depend on $(PARAMS_H).
* tree-data-ref.h (find_data_references_in_loop): Remove declaration.
* tree-data-ref.c (find_data_references_in_loop): Make static.
(compute_all_dependences): Change return type to bool. Bail out
for too many datarefs in a loop. Move the hunk resetting the data
dependences vector from ...
(compute_data_dependences_for_loop): ... here. Account for
compute_all_dependences returning false.
(compute_data_dependences_for_bb): Likewise.
* params.def (PARAM_LOOP_MAX_DATAREFS_FOR_DATADEPS): New param.
* doc/invoke.texi (loop-max-datarefs-for-datadeps): Document it.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@183624 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-data-ref.c')
-rw-r--r-- | gcc/tree-data-ref.c | 44 |
1 files changed, 25 insertions, 19 deletions
diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c index 09929c79ebf..b8dfa317f17 100644 --- a/gcc/tree-data-ref.c +++ b/gcc/tree-data-ref.c @@ -85,6 +85,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-pass.h" #include "langhooks.h" #include "tree-affine.h" +#include "params.h" static struct datadep_stats { @@ -4134,9 +4135,10 @@ compute_affine_dependence (struct data_dependence_relation *ddr, /* Compute in DEPENDENCE_RELATIONS the data dependence graph for all the data references in DATAREFS, in the LOOP_NEST. When COMPUTE_SELF_AND_RR is FALSE, don't compute read-read and self - relations. */ + relations. Return true when successful, i.e. data references number + is small enough to be handled. */ -void +bool compute_all_dependences (VEC (data_reference_p, heap) *datarefs, VEC (ddr_p, heap) **dependence_relations, VEC (loop_p, heap) *loop_nest, @@ -4146,6 +4148,18 @@ compute_all_dependences (VEC (data_reference_p, heap) *datarefs, struct data_reference *a, *b; unsigned int i, j; + if ((int) VEC_length (data_reference_p, datarefs) + > PARAM_VALUE (PARAM_LOOP_MAX_DATAREFS_FOR_DATADEPS)) + { + struct data_dependence_relation *ddr; + + /* Insert a single relation into dependence_relations: + chrec_dont_know. */ + ddr = initialize_data_dependence_relation (NULL, NULL, loop_nest); + VEC_safe_push (ddr_p, heap, *dependence_relations, ddr); + return false; + } + FOR_EACH_VEC_ELT (data_reference_p, datarefs, i, a) for (j = i + 1; VEC_iterate (data_reference_p, datarefs, j, b); j++) if (DR_IS_WRITE (a) || DR_IS_WRITE (b) || compute_self_and_rr) @@ -4164,6 +4178,8 @@ compute_all_dependences (VEC (data_reference_p, heap) *datarefs, if (loop_nest) compute_affine_dependence (ddr, VEC_index (loop_p, loop_nest, 0)); } + + return true; } /* Stores the locations of memory references in STMT to REFERENCES. Returns @@ -4338,7 +4354,7 @@ find_data_references_in_bb (struct loop *loop, basic_block bb, TODO: This function should be made smarter so that it can handle address arithmetic as if they were array accesses, etc. */ -tree +static tree find_data_references_in_loop (struct loop *loop, VEC (data_reference_p, heap) **datarefs) { @@ -4427,19 +4443,10 @@ compute_data_dependences_for_loop (struct loop *loop, dependences. */ if (!loop || !find_loop_nest (loop, loop_nest) - || find_data_references_in_loop (loop, datarefs) == chrec_dont_know) - { - struct data_dependence_relation *ddr; - - /* Insert a single relation into dependence_relations: - chrec_dont_know. */ - ddr = initialize_data_dependence_relation (NULL, NULL, *loop_nest); - VEC_safe_push (ddr_p, heap, *dependence_relations, ddr); - res = false; - } - else - compute_all_dependences (*datarefs, dependence_relations, *loop_nest, - compute_self_and_read_read_dependences); + || find_data_references_in_loop (loop, datarefs) == chrec_dont_know + || !compute_all_dependences (*datarefs, dependence_relations, *loop_nest, + compute_self_and_read_read_dependences)) + res = false; if (dump_file && (dump_flags & TDF_STATS)) { @@ -4507,9 +4514,8 @@ compute_data_dependences_for_bb (basic_block bb, if (find_data_references_in_bb (NULL, bb, datarefs) == chrec_dont_know) return false; - compute_all_dependences (*datarefs, dependence_relations, NULL, - compute_self_and_read_read_dependences); - return true; + return compute_all_dependences (*datarefs, dependence_relations, NULL, + compute_self_and_read_read_dependences); } /* Entry point (for testing only). Analyze all the data references |