diff options
| author | dorit <dorit@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-02-12 13:14:52 +0000 |
|---|---|---|
| committer | dorit <dorit@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-02-12 13:14:52 +0000 |
| commit | 20ae4d7b13ea8a672525834c808bb90585572763 (patch) | |
| tree | e603124bde74fd9d2dfcbd602643a9464d62b175 | |
| parent | 43667bd37b4c8b2be902252fb9c89d9dd4204613 (diff) | |
| download | ppe42-gcc-20ae4d7b13ea8a672525834c808bb90585572763.tar.gz ppe42-gcc-20ae4d7b13ea8a672525834c808bb90585572763.zip | |
PR tree-optimization/29145
* tree-data-ref.c (base_addr_differ_p): Make us more conservative
in our handling of restrict qualified pointers.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@121844 138bc75d-0d04-0410-961f-82ee72b054a4
| -rw-r--r-- | gcc/ChangeLog | 6 | ||||
| -rw-r--r-- | gcc/testsuite/ChangeLog | 9 | ||||
| -rw-r--r-- | gcc/testsuite/gcc.dg/vect/pr29145.c | 48 | ||||
| -rw-r--r-- | gcc/testsuite/gcc.dg/vect/vect-74.c | 11 | ||||
| -rw-r--r-- | gcc/testsuite/gcc.dg/vect/vect-80.c | 10 | ||||
| -rw-r--r-- | gcc/tree-data-ref.c | 20 |
6 files changed, 92 insertions, 12 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c21e25fc1e0..3e65ea41e64 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2007-02-12 Dorit Nuzman <dorit@il.ibm.com> + + PR tree-optimization/29145 + * tree-data-ref.c (base_addr_differ_p): Make us more conservative + in our handling of restrict qualified pointers. + 2007-02-12 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR middle-end/7651 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6ef96fea544..822bcff203b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2007-02-12 Dorit Nuzman <dorit@il.ibm.com> + + PR tree-optimization/29145 + * gcc.dg/vect/vect-74.c: Xfail the test - cannot be vectorized until + alias analysis is improved to take better advantage of restrict + qualified pointers. + * gcc.dg/vect/vect-80.c: Likewise. + * gcc.dg/vect/pr29145.c: New. + 2007-02-11 H.J. Lu <hongjiu.lu@intel.com> * gcc.target/i386/sse4a-extract.c: Add "LL" to 64bit constants. diff --git a/gcc/testsuite/gcc.dg/vect/pr29145.c b/gcc/testsuite/gcc.dg/vect/pr29145.c new file mode 100644 index 00000000000..97d190ca278 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr29145.c @@ -0,0 +1,48 @@ +/* { dg-require-effective-target vect_int } */ + +#include <stdarg.h> +#include "tree-vect.h" + +void with_restrict(int * __restrict p) +{ + int i; + int *q = p - 2; + + for (i = 0; i < 1000; ++i) { + p[i] = q[i]; + } +} + +void without_restrict(int * p) +{ + int i; + int *q = p - 2; + + for (i = 0; i < 1000; ++i) { + p[i] = q[i]; + } +} + +int main(void) +{ + int i; + int a[1002]; + int b[1002]; + + for (i = 0; i < 1002; ++i) { + a[i] = b[i] = i; + } + + with_restrict(a + 2); + without_restrict(b + 2); + + for (i = 0; i < 1002; ++i) { + if (a[i] != b[i]) + abort(); + } + return 0; +} + +/* { dg-final { scan-tree-dump-times "vectorized 0 loops" 2 "vect" } } */ +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-74.c b/gcc/testsuite/gcc.dg/vect/vect-74.c index f9095e8abcb..08155128eef 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-74.c +++ b/gcc/testsuite/gcc.dg/vect/vect-74.c @@ -42,8 +42,11 @@ int main (void) return 0; } -/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ -/* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 3 "vect" { target vect_no_align } } } */ -/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 2 "vect" { xfail vect_no_align } } } */ -/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { xfail vect_no_align } } } */ +/* Xfail until handling restrict is refined. See pr29145 */ +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */ +/* Uncomment when this testcase gets vectorized again: + dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 3 "vect" { target vect_no_align } } + dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 2 "vect" { xfail vect_no_align } } + dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { xfail vect_no_align } } +*/ /* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-80.c b/gcc/testsuite/gcc.dg/vect/vect-80.c index 3696b52c460..916935cbe50 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-80.c +++ b/gcc/testsuite/gcc.dg/vect/vect-80.c @@ -47,8 +47,10 @@ int main (void) all three accesses (peeling to align the store will not force the two loads to be aligned). */ -/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ -/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 2 "vect" { xfail vect_no_align } } } */ -/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { xfail vect_no_align } } } */ -/* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning." 3 "vect" { target vect_no_align } } } */ +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */ +/* Uncomment when this testcase gets vectorized again: + dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 2 "vect" { xfail vect_no_align } } + dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { xfail vect_no_align } } + dg-final { scan-tree-dump-times "Alignment of access forced using versioning." 3 "vect" { target vect_no_align } } +*/ /* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c index 794bb83f3a3..d49d68220c0 100644 --- a/gcc/tree-data-ref.c +++ b/gcc/tree-data-ref.c @@ -490,6 +490,7 @@ base_addr_differ_p (struct data_reference *dra, tree addr_a = DR_BASE_ADDRESS (dra); tree addr_b = DR_BASE_ADDRESS (drb); tree type_a, type_b; + tree decl_a, decl_b; bool aliased; if (!addr_a || !addr_b) @@ -547,14 +548,25 @@ base_addr_differ_p (struct data_reference *dra, } /* An instruction writing through a restricted pointer is "independent" of any - instruction reading or writing through a different pointer, in the same - block/scope. */ - else if ((TYPE_RESTRICT (type_a) && !DR_IS_READ (dra)) - || (TYPE_RESTRICT (type_b) && !DR_IS_READ (drb))) + instruction reading or writing through a different restricted pointer, + in the same block/scope. */ + else if (TYPE_RESTRICT (type_a) + && TYPE_RESTRICT (type_b) + && (!DR_IS_READ (drb) || !DR_IS_READ (dra)) + && TREE_CODE (DR_BASE_ADDRESS (dra)) == SSA_NAME + && (decl_a = SSA_NAME_VAR (DR_BASE_ADDRESS (dra))) + && TREE_CODE (decl_a) == PARM_DECL + && TREE_CODE (DECL_CONTEXT (decl_a)) == FUNCTION_DECL + && TREE_CODE (DR_BASE_ADDRESS (drb)) == SSA_NAME + && (decl_b = SSA_NAME_VAR (DR_BASE_ADDRESS (drb))) + && TREE_CODE (decl_b) == PARM_DECL + && TREE_CODE (DECL_CONTEXT (decl_b)) == FUNCTION_DECL + && DECL_CONTEXT (decl_a) == DECL_CONTEXT (decl_b)) { *differ_p = true; return true; } + return false; } |

