diff options
author | Sebastian Pop <sebastian.pop@amd.com> | 2010-08-02 16:20:36 +0000 |
---|---|---|
committer | Sebastian Pop <spop@gcc.gnu.org> | 2010-08-02 16:20:36 +0000 |
commit | 20769d5eb6854f1dec44744721ec17c52609254d (patch) | |
tree | 167b7b8803b20ddb17ea9f205ec3cd9c4746e278 /gcc/tree-loop-distribution.c | |
parent | ef973f3f4b72e19f6e1354f4cbd9f387bbb7e510 (diff) | |
download | gcc-20769d5eb6854f1dec44744721ec17c52609254d.zip gcc-20769d5eb6854f1dec44744721ec17c52609254d.tar.gz gcc-20769d5eb6854f1dec44744721ec17c52609254d.tar.bz2 |
Add -ftree-loop-distribute-patterns enabled at -O3.
2010-08-02 Sebastian Pop <sebastian.pop@amd.com>
* common.opt (ftree-loop-distribute-patterns): New.
* invoke.texi (-ftree-loop-distribute-patterns): Documented.
* opts.c (decode_options): Enable flag_tree_loop_distribute_patterns
at -O3.
* tree-data-ref.c (stores_zero_from_loop): New.
* tree-data-ref.h (stores_zero_from_loop): Declared.
* tree-loop-distribution.c (tree_loop_distribution): Call
stores_zero_from_loop.
(tree_loop_distribution): Check flag_tree_loop_distribute_patterns.
From-SVN: r162822
Diffstat (limited to 'gcc/tree-loop-distribution.c')
-rw-r--r-- | gcc/tree-loop-distribution.c | 45 |
1 files changed, 32 insertions, 13 deletions
diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c index 099a7fe..5905406 100644 --- a/gcc/tree-loop-distribution.c +++ b/gcc/tree-loop-distribution.c @@ -1184,18 +1184,36 @@ tree_loop_distribution (void) { VEC (gimple, heap) *work_list = VEC_alloc (gimple, heap, 3); - /* With the following working list, we're asking distribute_loop - to separate the stores of the loop: when dependences allow, - it will end on having one store per loop. */ - stores_from_loop (loop, &work_list); - - /* A simple heuristic for cache locality is to not split stores - to the same array. Without this call, an unrolled loop would - be split into as many loops as unroll factor, each loop - storing in the same array. */ - remove_similar_memory_refs (&work_list); - - nb_generated_loops = distribute_loop (loop, work_list); + /* If both flag_tree_loop_distribute_patterns and + flag_tree_loop_distribution are set, then only + distribute_patterns is executed. */ + if (flag_tree_loop_distribute_patterns) + { + /* With the following working list, we're asking + distribute_loop to separate from the rest of the loop the + stores of the form "A[i] = 0". */ + stores_zero_from_loop (loop, &work_list); + + /* Do nothing if there are no patterns to be distributed. */ + if (VEC_length (gimple, work_list) > 0) + nb_generated_loops = distribute_loop (loop, work_list); + } + else if (flag_tree_loop_distribution) + { + /* With the following working list, we're asking + distribute_loop to separate the stores of the loop: when + dependences allow, it will end on having one store per + loop. */ + stores_from_loop (loop, &work_list); + + /* A simple heuristic for cache locality is to not split + stores to the same array. Without this call, an unrolled + loop would be split into as many loops as unroll factor, + each loop storing in the same array. */ + remove_similar_memory_refs (&work_list); + + nb_generated_loops = distribute_loop (loop, work_list); + } if (dump_file && (dump_flags & TDF_DETAILS)) { @@ -1217,7 +1235,8 @@ tree_loop_distribution (void) static bool gate_tree_loop_distribution (void) { - return flag_tree_loop_distribution != 0; + return flag_tree_loop_distribution + || flag_tree_loop_distribute_patterns; } struct gimple_opt_pass pass_loop_distribution = |