diff options
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 3cee320..094d168 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); |