From: Bin Cheng Date: Wed, 31 May 2017 09:01:36 +0000 (+0000) Subject: tree-data-ref.c (prune_runtime_alias_test_list): Relax minimal segment length for... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c7d7e2227f72d54ce3ec725693a0fac35455c555;p=gcc.git tree-data-ref.c (prune_runtime_alias_test_list): Relax minimal segment length for dr_b and compute it in wide_int. * tree-data-ref.c (prune_runtime_alias_test_list): Relax minimal segment length for dr_b and compute it in wide_int. gcc/testsuite * gcc.dg/vect/pr80815-3.c: New test. From-SVN: r248725 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8429b46d638..5fca7dcde8c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2017-05-31 Bin Cheng + + * tree-data-ref.c (prune_runtime_alias_test_list): Relax minimal + segment length for dr_b and compute it in wide_int. + 2017-05-31 Richard Biener PR tree-optimization/80906 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e336489188c..9fec6120618 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2017-05-31 Bin Cheng + + * gcc.dg/vect/pr80815-3.c: New test. + 2017-05-31 Richard Biener PR tree-optimization/80906 diff --git a/gcc/testsuite/gcc.dg/vect/pr80815-3.c b/gcc/testsuite/gcc.dg/vect/pr80815-3.c new file mode 100644 index 00000000000..dae01fa7af7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr80815-3.c @@ -0,0 +1,45 @@ +/* { dg-require-effective-target vect_int } */ + +#include "tree-vect.h" +int arr[2048]; +int res[100] = { 2148, 2146, 2144, 2142, 2140, 2138, 2136, 2134, 2132, 2130, + 2128, 2126, 2124, 2122, 2120, 2118, 2116, 2114, 2112, 2110, + 2108, 2106, 2104, 2102, 2100, 2098, 2096, 2094, 2092, 2090, + 2088, 2086, 2084, 2082, 2080, 2078, 2076, 2074, 2072, 2070, + 2068, 2066, 2064, 2062, 2060, 2058, 2056, 2054, 3078, 2050}; + +__attribute__ ((noinline)) int +foo (int *a, int *b, int len) +{ + int i; + int *a1 = a; + int *a0 = a1 - 4; + for (i = 0; i < len; i++) + { + *b = *a0 + *a1; + b--; + a0++; + a1++; + } + return 0; +} + +int main (void) +{ + int *a = &arr[1027]; + int *b = &arr[1024]; + + int i; + for (i = 0; i < 2048; i++) + arr[i] = i; + + foo (a, b, 50); + + for (i = 975; i < 1025; i++) + if (arr[i] != res[i - 975]) + abort (); + + return 0; +} + +/* { dg-final { scan-tree-dump "improved number of alias checks from \[0-9\]* to 1" "vect" } } */ diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c index cfff7c2a45c..c4275e2ce20 100644 --- a/gcc/tree-data-ref.c +++ b/gcc/tree-data-ref.c @@ -1361,14 +1361,10 @@ prune_runtime_alias_test_list (vec *alias_pairs, wide_int min_seg_len_b; tree new_seg_len; - if (tree_fits_uhwi_p (dr_b1->seg_len)) - { - min_seg_len_b = dr_b1->seg_len; - if (tree_int_cst_sign_bit (dr_b1->seg_len)) - min_seg_len_b = wi::neg (min_seg_len_b); - } + if (TREE_CODE (dr_b1->seg_len) == INTEGER_CST) + min_seg_len_b = wi::abs (dr_b1->seg_len); else - min_seg_len_b = wi::uhwi (factor, TYPE_PRECISION (sizetype)); + min_seg_len_b = wi::mul (factor, wi::abs (DR_STEP (dr_b1->dr))); /* Now we try to merge alias check dr_a1 & dr_b and dr_a2 & dr_b.