diff options
author | Sebastian Pop <spop@gcc.gnu.org> | 2010-12-02 16:53:16 +0000 |
---|---|---|
committer | Sebastian Pop <spop@gcc.gnu.org> | 2010-12-02 16:53:16 +0000 |
commit | 5e37ea0ef1bb8d9a27e6502a82b7b14f30d6d6b6 (patch) | |
tree | 88b1433f2415d2ff73482de80bdbdb30c4c04d7f /gcc/tree-data-ref.c | |
parent | b2087e8dad076c2482622329023cde67c631edbb (diff) | |
download | gcc-5e37ea0ef1bb8d9a27e6502a82b7b14f30d6d6b6.tar.gz |
Fix PR45199: do not aggregate memory accesses to the same array for -ftree-loop-distribute-patterns
2010-11-30 Sebastian Pop <sebastian.pop@amd.com>
PR tree-optimization/45199
* tree-data-ref.c (mem_write_stride_of_same_size_as_unit_type_p): New.
(stores_zero_from_loop): Call
mem_write_stride_of_same_size_as_unit_type_p.
* tree-data-ref.h (stride_of_unit_type_p): New.
* tree-loop-distribution.c (generate_memset_zero): Simplified.
Call stride_of_unit_type_p.
(build_rdg_partition_for_component): Do not call
rdg_flag_similar_memory_accesses when
flag_tree_loop_distribute_patterns is set.
* gcc.dg/tree-ssa/ldist-15.c: New.
* gcc.dg/tree-ssa/ldist-16.c: New.
* gfortran.dg/ldist-pr45199.f: New.
From-SVN: r167380
Diffstat (limited to 'gcc/tree-data-ref.c')
-rw-r--r-- | gcc/tree-data-ref.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c index 3cee320846b..094d16822a9 100644 --- a/gcc/tree-data-ref.c +++ b/gcc/tree-data-ref.c @@ -4974,6 +4974,27 @@ stores_from_loop (struct loop *loop, VEC (gimple, heap) **stmts) free (bbs); } +/* Returns true when STMT is an assignment that contains a data + reference on its LHS with a stride of the same size as its unit + type. */ + +static bool +mem_write_stride_of_same_size_as_unit_type_p (gimple stmt) +{ + struct data_reference *dr = XCNEW (struct data_reference); + tree op0 = gimple_assign_lhs (stmt); + bool res; + + DR_STMT (dr) = stmt; + DR_REF (dr) = op0; + + res = dr_analyze_innermost (dr) + && stride_of_unit_type_p (DR_STEP (dr), TREE_TYPE (op0)); + + free_data_ref (dr); + return res; +} + /* Initialize STMTS with all the statements of LOOP that contain a store to memory of the form "A[i] = 0". */ @@ -4994,7 +5015,8 @@ stores_zero_from_loop (struct loop *loop, VEC (gimple, heap) **stmts) && is_gimple_assign (stmt) && gimple_assign_rhs_code (stmt) == INTEGER_CST && (op = gimple_assign_rhs1 (stmt)) - && (integer_zerop (op) || real_zerop (op))) + && (integer_zerop (op) || real_zerop (op)) + && mem_write_stride_of_same_size_as_unit_type_p (stmt)) VEC_safe_push (gimple, heap, *stmts, gsi_stmt (si)); free (bbs); |