diff options
author | mrs <mrs@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-01-03 23:45:56 +0000 |
---|---|---|
committer | mrs <mrs@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-01-03 23:45:56 +0000 |
commit | fe644b69d013e77c7fc2db2a9863969d4f564561 (patch) | |
tree | a2cb1398bd46b8decaea84f1b7de8c7cd35e6046 /gcc/tree-vect-loop-manip.c | |
parent | 90079d10dd355193fe289fa0bfcb0d7be880d45a (diff) | |
parent | 04e0495a6da35f3b0bcedbd75908cb6e9ba8ff8f (diff) | |
download | gcc-fe644b69d013e77c7fc2db2a9863969d4f564561.tar.gz |
Merge in trunk.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/wide-int@206327 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-vect-loop-manip.c')
-rw-r--r-- | gcc/tree-vect-loop-manip.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/gcc/tree-vect-loop-manip.c b/gcc/tree-vect-loop-manip.c index 7fdb08205a8..ecb446c02f4 100644 --- a/gcc/tree-vect-loop-manip.c +++ b/gcc/tree-vect-loop-manip.c @@ -1,5 +1,5 @@ /* Vectorizer Specific Loop Manipulations - Copyright (C) 2003-2013 Free Software Foundation, Inc. + Copyright (C) 2003-2014 Free Software Foundation, Inc. Contributed by Dorit Naishlos <dorit@il.ibm.com> and Ira Rosen <irar@il.ibm.com> @@ -2240,13 +2240,24 @@ vect_create_cond_for_alias_checks (loop_vec_info loop_vinfo, tree * cond_expr) tree seg_a_min = addr_base_a; tree seg_a_max = fold_build_pointer_plus (addr_base_a, segment_length_a); + /* For negative step, we need to adjust address range by TYPE_SIZE_UNIT + bytes, e.g., int a[3] -> a[1] range is [a+4, a+16) instead of + [a, a+12) */ if (tree_int_cst_compare (DR_STEP (dr_a.dr), size_zero_node) < 0) - seg_a_min = seg_a_max, seg_a_max = addr_base_a; + { + tree unit_size = TYPE_SIZE_UNIT (TREE_TYPE (DR_REF (dr_a.dr))); + seg_a_min = fold_build_pointer_plus (seg_a_max, unit_size); + seg_a_max = fold_build_pointer_plus (addr_base_a, unit_size); + } tree seg_b_min = addr_base_b; tree seg_b_max = fold_build_pointer_plus (addr_base_b, segment_length_b); if (tree_int_cst_compare (DR_STEP (dr_b.dr), size_zero_node) < 0) - seg_b_min = seg_b_max, seg_b_max = addr_base_b; + { + tree unit_size = TYPE_SIZE_UNIT (TREE_TYPE (DR_REF (dr_b.dr))); + seg_b_min = fold_build_pointer_plus (seg_b_max, unit_size); + seg_b_max = fold_build_pointer_plus (addr_base_b, unit_size); + } part_cond_expr = fold_build2 (TRUTH_OR_EXPR, boolean_type_node, |