diff options
author | Ira Rosen <irar@gcc.gnu.org> | 2007-02-22 13:10:49 +0000 |
---|---|---|
committer | Ira Rosen <irar@gcc.gnu.org> | 2007-02-22 13:10:49 +0000 |
commit | 021a93e31e6e020b2b8393e3a7f99274e3ad8456 (patch) | |
tree | 11bbc10f68c15a604e8b77a8dac5135a2a899cb5 | |
parent | 8fca6de5641592fdaa5e03a415b1727f5e1ddcaf (diff) | |
download | gcc-021a93e31e6e020b2b8393e3a7f99274e3ad8456.zip gcc-021a93e31e6e020b2b8393e3a7f99274e3ad8456.tar.gz gcc-021a93e31e6e020b2b8393e3a7f99274e3ad8456.tar.bz2 |
* tree-data-ref.c (ptr_ptr_may_alias_p): Take alias sets into account.
From-SVN: r122226
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rwxr-xr-x | gcc/testsuite/gcc.dg/vect/vect-106.c | 73 | ||||
-rw-r--r-- | gcc/tree-data-ref.c | 15 |
4 files changed, 96 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 29b23b7..d7f0f49 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2007-02-22 Zdenek Dvorak <dvorakz@suse.cz> + Ira Rosen <irar@il.ibm.com> + + * tree-data-ref.c (ptr_ptr_may_alias_p): Take alias sets into account. + 2007-02-22 Ira Rosen <irar@il.ibm.com> PR tree-optimization/30843 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index bc8535c..1e52e49 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2007-02-22 Ira Rosen <irar@il.ibm.com> + + * gcc.dg/vect/vect-106.c: New test. + 2007-02-22 Dorit Nuzman <dorit@il.ibm.com> Ira Rosen <irar@il.ibm.com> diff --git a/gcc/testsuite/gcc.dg/vect/vect-106.c b/gcc/testsuite/gcc.dg/vect/vect-106.c new file mode 100755 index 0000000..04a9f6c --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-106.c @@ -0,0 +1,73 @@ +/* { dg-require-effective-target vect_int } */ + +#include <stdlib.h> +#include <stdarg.h> +#include "tree-vect.h" + +#define N 9 + +static int a[N] = {1,2,3,4,5,6,7,8,9}; +static int b[N] = {2,3,4,5,6,7,8,9,0}; + +int main1 () { + int i; + int *p, *q, *p1, *q1; + p = (unsigned int *) malloc (sizeof (unsigned int) * N); + q = (unsigned int *) malloc (sizeof (unsigned int) * N); + + p1 = p; q1 = q; + + /* Not vectorizable: because of the redundant cast (caused by ponter + arithmetics), alias analysis fails to distinguish between + the pointers. */ + for (i = 0; i < N; i++) + { + *(q + i) = a[i]; + *(p + i) = b[i]; + } + + /* check results: */ + for (i = 0; i < N; i++) + { + if (*q != a[i] || *p != b[i]) + abort(); + q++; + p++; + } + + q = q1; + p = p1; + /* Vectorizable. */ + for (i = 0; i < N; i++) + { + *q = b[i]; + *p = a[i]; + q++; + p++; + } + + q = q1; + p = p1; + /* check results: */ + for (i = 0; i < N; i++) + { + if (*q != b[i] || *p != a[i]) + abort(); + q++; + p++; + } + + return 0; +} + +int main (void) +{ + check_vect (); + + return main1 (); +} + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ +/* { dg-final { scan-tree-dump-times "can't determine dependence" 1 "vect" } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */ + diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c index b84f36b..2f57c4f 100644 --- a/gcc/tree-data-ref.c +++ b/gcc/tree-data-ref.c @@ -172,6 +172,7 @@ ptr_ptr_may_alias_p (tree ptr_a, tree ptr_b, tree tag_a = NULL_TREE, tag_b = NULL_TREE; struct ptr_info_def *pi_a = DR_PTR_INFO (dra); struct ptr_info_def *pi_b = DR_PTR_INFO (drb); + bitmap bal1, bal2; if (pi_a && pi_a->name_mem_tag && pi_b && pi_b->name_mem_tag) { @@ -192,7 +193,19 @@ ptr_ptr_may_alias_p (tree ptr_a, tree ptr_b, if (!tag_b) return false; } - *aliased = (tag_a == tag_b); + bal1 = BITMAP_ALLOC (NULL); + bitmap_set_bit (bal1, DECL_UID (tag_a)); + if (MTAG_P (tag_a) && MTAG_ALIASES (tag_a)) + bitmap_ior_into (bal1, MTAG_ALIASES (tag_a)); + + bal2 = BITMAP_ALLOC (NULL); + bitmap_set_bit (bal2, DECL_UID (tag_b)); + if (MTAG_P (tag_b) && MTAG_ALIASES (tag_b)) + bitmap_ior_into (bal2, MTAG_ALIASES (tag_b)); + *aliased = bitmap_intersect_p (bal1, bal2); + + BITMAP_FREE (bal1); + BITMAP_FREE (bal2); return true; } |