* tree-data-ref.c (ptr_ptr_may_alias_p): Take alias sets into account.
From-SVN: r122226
This commit is contained in:
parent
8fca6de564
commit
021a93e31e
4 changed files with 96 additions and 1 deletions
|
@ -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
|
||||
|
|
|
@ -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>
|
||||
|
||||
|
|
73
gcc/testsuite/gcc.dg/vect/vect-106.c
Executable file
73
gcc/testsuite/gcc.dg/vect/vect-106.c
Executable file
|
@ -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" } } */
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue