summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormeibf <meibf@138bc75d-0d04-0410-961f-82ee72b054a4>2014-01-03 15:40:57 +0000
committermeibf <meibf@138bc75d-0d04-0410-961f-82ee72b054a4>2014-01-03 15:40:57 +0000
commit6e984e6f0818b78ca5d3feb7005bcbdba69a6091 (patch)
tree4bd50bb744ce8fbbe28950f5da0d1188ce74dd26
parent7e862b4e196dc67a46156d215ebfa5ea5c2af614 (diff)
downloadgcc-6e984e6f0818b78ca5d3feb7005bcbdba69a6091.tar.gz
2014-01-03 Bingfeng Mei <bmei@broadcom.com>
PR tree-optimization/59651 * tree-vect-loop-manip.c (vect_create_cond_for_alias_checks): Address range for negative step should be added by TYPE_SIZE_UNIT. PR tree-optimization/59651 * gcc.dg/torture/pr59651.c: New test. * gcc.dg/vect/pr59651.c: Ditto. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@206319 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr59651.c20
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr59651.c4
-rw-r--r--gcc/tree-vect-loop-manip.c15
5 files changed, 49 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1cb81b7aa4a..cf4cfabeb82 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2014-01-03 Bingfeng Mei <bmei@broadcom.com>
+
+ PR tree-optimization/59651
+ * tree-vect-loop-manip.c (vect_create_cond_for_alias_checks):
+ Address range for negative step should be added by TYPE_SIZE_UNIT.
+
2014-01-03 Andreas Schwab <schwab@linux-m68k.org>
* config/m68k/m68k.c (handle_move_double): Handle pushes with
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 49b55f8b49e..b7639618d19 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2014-01-03 Bingfeng Mei <bmei@broadcom.com>
+
+ PR tree-optimization/59651
+ * gcc.dg/torture/pr59651.c: New test.
+ * gcc.dg/vect/pr59651.c: Ditto.
+
2014-01-03 Jakub Jelinek <jakub@redhat.com>
PR target/59625
diff --git a/gcc/testsuite/gcc.dg/torture/pr59651.c b/gcc/testsuite/gcc.dg/torture/pr59651.c
new file mode 100644
index 00000000000..7139ba9bf52
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr59651.c
@@ -0,0 +1,20 @@
+/* PR tree-optimization/59561 */
+/* { dg-do run } */
+
+extern void abort (void);
+int a[] = { 0, 0, 0, 0, 0, 0, 0, 6 };
+
+int b;
+int
+main ()
+{
+ for (;;)
+ {
+ for (b = 7; b; --b)
+ a[b] = a[7] > 1;
+ break;
+ }
+ if (a[1] != 0)
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/vect/pr59651.c b/gcc/testsuite/gcc.dg/vect/pr59651.c
new file mode 100644
index 00000000000..4407785aab4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr59651.c
@@ -0,0 +1,4 @@
+/* PR tree-optimization/59561 */
+#include "../torture/pr59651.c"
+
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/tree-vect-loop-manip.c b/gcc/tree-vect-loop-manip.c
index 3eb85a5c498..e8dbf4daf46 100644
--- a/gcc/tree-vect-loop-manip.c
+++ b/gcc/tree-vect-loop-manip.c
@@ -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,