]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
2016-02-08 Richard Biener <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 8 Feb 2016 14:51:20 +0000 (14:51 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 8 Feb 2016 14:51:20 +0000 (14:51 +0000)
PR tree-optimization/69719
* tree-vect-data-refs.c (vect_prune_runtime_alias_test_list):
Properly use absolute of the difference of the two offsets to
compare or adjust the segment length.

* gcc.dg/torture/pr69719.c: New testcase.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@233212 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr69719.c [new file with mode: 0644]
gcc/tree-vect-data-refs.c

index c9d1d51959fdf6aa6e67a6626a86955548dd93dc..a2fb881fabadd623e2a1204f486cf698f0cce3a6 100644 (file)
@@ -1,3 +1,10 @@
+2016-02-08  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/69719
+       * tree-vect-data-refs.c (vect_prune_runtime_alias_test_list):
+       Properly use absolute of the difference of the two offsets to
+       compare or adjust the segment length.
+
 2016-02-08  Richard Biener  <rguenther@suse.de>
        Jeff Law  <law@redhat.com>
 
index 60c95ae95302319c19ba29d5fc579058ae44d7e3..f39a510f3adf66e6b277b7c9a10878e0659077b4 100644 (file)
@@ -1,3 +1,8 @@
+2016-02-08  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/69719
+       * gcc.dg/torture/pr69719.c: New testcase.
+
 2016-02-08  Richard Biener  <rguenther@suse.de>
        Jeff Law  <law@redhat.com>
 
diff --git a/gcc/testsuite/gcc.dg/torture/pr69719.c b/gcc/testsuite/gcc.dg/torture/pr69719.c
new file mode 100644 (file)
index 0000000..d7489e7
--- /dev/null
@@ -0,0 +1,24 @@
+/* { dg-do run } */
+
+int b, c = 1, e, f; 
+int a[6][5] = { {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 1, 0, 0, 0} };
+
+void  __attribute__((noinline))
+fn1 ()
+{
+  int d;
+  for (b = 0; b < 5; b++)
+    for (d = 4; d; d--)
+      a[c + 1][b] = a[d + 1][d];
+}
+
+int
+main ()
+{
+  fn1 ();
+
+  if (a[2][1] != 0) 
+    __builtin_abort (); 
+
+  return 0; 
+}
index 4c0e1352fa67eeaefad3e10c68f785071b7a2f4e..49e871b1411d9690d9b1749ba535b7481f52ce16 100644 (file)
@@ -3081,8 +3081,9 @@ vect_prune_runtime_alias_test_list (loop_vec_info loop_vinfo)
              || !tree_fits_shwi_p (dr_a2->offset))
            continue;
 
-         HOST_WIDE_INT diff = (tree_to_shwi (dr_a2->offset)
-                               - tree_to_shwi (dr_a1->offset));
+         unsigned HOST_WIDE_INT diff
+           = absu_hwi (tree_to_shwi (dr_a2->offset)
+                       - tree_to_shwi (dr_a1->offset));
 
 
          /* Now we check if the following condition is satisfied:
@@ -3101,13 +3102,14 @@ vect_prune_runtime_alias_test_list (loop_vec_info loop_vinfo)
 
             */
 
-         HOST_WIDE_INT  min_seg_len_b = (tree_fits_shwi_p (dr_b1->seg_len)
-                                         ? tree_to_shwi (dr_b1->seg_len)
-                                         : vect_factor);
+         unsigned HOST_WIDE_INT min_seg_len_b
+           = (tree_fits_uhwi_p (dr_b1->seg_len)
+              ? tree_to_uhwi (dr_b1->seg_len)
+              : vect_factor);
 
          if (diff <= min_seg_len_b
-             || (tree_fits_shwi_p (dr_a1->seg_len)
-                 && diff - tree_to_shwi (dr_a1->seg_len) < min_seg_len_b))
+             || (tree_fits_uhwi_p (dr_a1->seg_len)
+                 && diff - tree_to_uhwi (dr_a1->seg_len) < min_seg_len_b))
            {
              if (dump_enabled_p ())
                {