diff options
author | Richard Guenther <rguenther@suse.de> | 2009-04-09 08:07:31 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2009-04-09 08:07:31 +0000 |
commit | 22a65a54cc52c1e2081ef202523cce5505f6d85b (patch) | |
tree | c27706ee771d0ae8550beb8fc38fe98f547e8e9a | |
parent | f76968e6d5ab3ca8bd5b64ba0143197c00f59943 (diff) | |
download | gcc-22a65a54cc52c1e2081ef202523cce5505f6d85b.zip gcc-22a65a54cc52c1e2081ef202523cce5505f6d85b.tar.gz gcc-22a65a54cc52c1e2081ef202523cce5505f6d85b.tar.bz2 |
c-gimplify.c (c_gimplify_expr): Fix the invalid GENERIC &ARRAY addresses by adjusting their types and...
2009-04-09 Richard Guenther <rguenther@suse.de>
* c-gimplify.c (c_gimplify_expr): Fix the invalid GENERIC
&ARRAY addresses by adjusting their types and prepending
a conversion.
* tree-cfg.c (verify_gimple_assign_single): Verify that
addresses are correct.
* gcc.dg/vect/vect-54.c: Make constant input data file-scope
to prevent constant propagation.
* gcc.dg/vect/vect-56.c: Likewise.
* gcc.dg/vect/vect-58.c: Likewise.
* gcc.dg/vect/vect-60.c: Likewise.
* gcc.dg/vect/no-vfa-vect-57.c: Likewise.
* gcc.dg/vect/no-vfa-vect-61.c: Likewise.
* gcc.dg/tree-prof/stringop-2.c: Adjust expected outcome.
From-SVN: r145800
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/c-gimplify.c | 14 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 11 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/tree-prof/stringop-2.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/vect/no-vfa-vect-57.c | 16 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/vect/no-vfa-vect-61.c | 16 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/vect/vect-54.c | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/vect/vect-56.c | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/vect/vect-58.c | 3 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/vect/vect-60.c | 5 | ||||
-rw-r--r-- | gcc/tree-cfg.c | 7 |
11 files changed, 76 insertions, 18 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f9ffe70..0a9d5f2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2009-04-06 Richard Guenther <rguenther@suse.de> + + * c-gimplify.c (c_gimplify_expr): Fix the invalid GENERIC + &ARRAY addresses by adjusting their types and prepending + a conversion. + * tree-cfg.c (verify_gimple_assign_single): Verify that + addresses are correct. + 2009-04-09 Richard Guenther <rguenther@suse.de> * tree-ssa-ccp.c (maybe_fold_stmt_addition): Move non-constant diff --git a/gcc/c-gimplify.c b/gcc/c-gimplify.c index 9cb4a0b..cf06974 100644 --- a/gcc/c-gimplify.c +++ b/gcc/c-gimplify.c @@ -196,5 +196,19 @@ c_gimplify_expr (tree *expr_p, gimple_seq *pre_p ATTRIBUTE_UNUSED, && !warn_init_self) TREE_NO_WARNING (DECL_EXPR_DECL (*expr_p)) = 1; + /* The C frontend is the only one producing &ARRAY with pointer-to-element + type. This is invalid in gimple, so produce a properly typed + ADDR_EXPR instead and wrap a conversion around it. */ + if (code == ADDR_EXPR + && TREE_CODE (TREE_TYPE (TREE_OPERAND (*expr_p, 0))) == ARRAY_TYPE + && TREE_CODE (TREE_TYPE (TREE_TYPE (*expr_p))) != ARRAY_TYPE) + { + tree type = TREE_TYPE (*expr_p); + TREE_TYPE (*expr_p) + = build_pointer_type (TREE_TYPE (TREE_OPERAND (*expr_p, 0))); + *expr_p = build1 (NOP_EXPR, type, *expr_p); + return GS_OK; + } + return GS_UNHANDLED; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e56170e1..0a2ff3a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,16 @@ 2009-04-09 Richard Guenther <rguenther@suse.de> + * gcc.dg/vect/vect-54.c: Make constant input data file-scope + to prevent constant propagation. + * gcc.dg/vect/vect-56.c: Likewise. + * gcc.dg/vect/vect-58.c: Likewise. + * gcc.dg/vect/vect-60.c: Likewise. + * gcc.dg/vect/no-vfa-vect-57.c: Likewise. + * gcc.dg/vect/no-vfa-vect-61.c: Likewise. + * gcc.dg/tree-prof/stringop-2.c: Adjust expected outcome. + +2009-04-09 Richard Guenther <rguenther@suse.de> + * gcc.dg/tree-ssa/ssa-ccp-25.c: New testcase. * gcc.dg/tree-ssa/ssa-ccp-26.c: Likewise. diff --git a/gcc/testsuite/gcc.dg/tree-prof/stringop-2.c b/gcc/testsuite/gcc.dg/tree-prof/stringop-2.c index 3e7bd54..e6b4999 100644 --- a/gcc/testsuite/gcc.dg/tree-prof/stringop-2.c +++ b/gcc/testsuite/gcc.dg/tree-prof/stringop-2.c @@ -14,7 +14,7 @@ main() return 0; } /* { dg-final-use { scan-tree-dump "Single value 4 stringop" "tree_profile"} } */ -/* Really this ought to simplify into assignment, but we are not there yet. */ -/* { dg-final-use { scan-tree-dump "memset.*4\\)" "optimized"} } */ +/* The versioned memset of size 4 should be optimized to an assignment. */ +/* { dg-final-use { scan-tree-dump "a\\\[0\\\] = 168430090" "optimized"} } */ /* { dg-final-use { cleanup-tree-dump "optimized" } } */ /* { dg-final-use { cleanup-tree-dump "tree_profile" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/no-vfa-vect-57.c b/gcc/testsuite/gcc.dg/vect/no-vfa-vect-57.c index b7ef4b4..a80f633 100644 --- a/gcc/testsuite/gcc.dg/vect/no-vfa-vect-57.c +++ b/gcc/testsuite/gcc.dg/vect/no-vfa-vect-57.c @@ -1,6 +1,7 @@ /* { dg-require-effective-target vect_float } */ #include <stdarg.h> +#include <string.h> #include "tree-vect.h" #define N 256 @@ -20,6 +21,15 @@ void bar (float *pa, float *pb, float *pc) return; } +__attribute__ ((noinline)) +void foo (float *pb, float *pc) +{ + float b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57}; + float c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19}; + memcpy (pb, b, sizeof (b)); + memcpy (pc, c, sizeof (c)); +} + /* Unaligned pointer read accesses with known alignment, and an unaligned write access with unknown alignment. The loop bound is known and divisible by the vectorization factor. @@ -33,11 +43,13 @@ __attribute__ ((noinline)) int main1 (float *pa) { int i; - float b[N] __attribute__ ((__aligned__(16))) = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57}; - float c[N] __attribute__ ((__aligned__(16))) = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19}; + float b[N] __attribute__ ((__aligned__(16))); + float c[N] __attribute__ ((__aligned__(16))); float *pb = b; float *pc = c; + foo (pb, pc); + for (i = 0; i < N/2; i++) { pa[i] = pb[i+1] * pc[i+1]; diff --git a/gcc/testsuite/gcc.dg/vect/no-vfa-vect-61.c b/gcc/testsuite/gcc.dg/vect/no-vfa-vect-61.c index 39491a8..582ca12 100644 --- a/gcc/testsuite/gcc.dg/vect/no-vfa-vect-61.c +++ b/gcc/testsuite/gcc.dg/vect/no-vfa-vect-61.c @@ -2,6 +2,7 @@ /* { dg-require-effective-target vect_float } */ #include <stdarg.h> +#include <string.h> #include "tree-vect.h" #define N 256 @@ -21,6 +22,15 @@ void bar (float *pa, float *pb, float *pc) return; } +__attribute__ ((noinline)) +void foo (float *pb, float *pc) +{ + float b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57}; + float c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19}; + memcpy (pb, b, sizeof (b)); + memcpy (pc, c, sizeof (c)); +} + /* Unaligned pointer read accesses with known alignment, and an unaligned write access with unknown alignment. The loop bound is iunknown. @@ -34,11 +44,13 @@ __attribute__ ((noinline)) int main1 (int n , float *pa) { int i; - float b[N] __attribute__ ((__aligned__(16))) = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57}; - float c[N] __attribute__ ((__aligned__(16))) = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19}; + float b[N] __attribute__ ((__aligned__(16))); + float c[N] __attribute__ ((__aligned__(16))); float *pb = b; float *pc = c; + foo (pb, pc); + for (i = 0; i < n/2; i++) { pa[i] = pb[i+1] * pc[i+1]; diff --git a/gcc/testsuite/gcc.dg/vect/vect-54.c b/gcc/testsuite/gcc.dg/vect/vect-54.c index 6e1aa54..a44cdd4 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-54.c +++ b/gcc/testsuite/gcc.dg/vect/vect-54.c @@ -26,13 +26,14 @@ void bar (float *pa, float *pb, float *pc) vect-58.c is similar to this one with one difference: the loop bound is unknown. */ +float b[N] __attribute__ ((__aligned__(16))) = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57}; +float c[N] __attribute__ ((__aligned__(16))) = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19}; + __attribute__ ((noinline)) int main1 () { int i; float a[N] __attribute__ ((__aligned__(16))); - float b[N] __attribute__ ((__aligned__(16))) = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57}; - float c[N] __attribute__ ((__aligned__(16))) = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19}; float *pa = a; float *pb = b; float *pc = c; diff --git a/gcc/testsuite/gcc.dg/vect/vect-56.c b/gcc/testsuite/gcc.dg/vect/vect-56.c index 387bd3a..624a112 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-56.c +++ b/gcc/testsuite/gcc.dg/vect/vect-56.c @@ -30,13 +30,14 @@ void bar (float *pa, float *pb, float *pc) vect-57.c is similar to this one with two differences: aliasing is a problem, and the write access has unknown alignment. */ +float b[N] __attribute__ ((__aligned__(16))) = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57}; +float c[N] __attribute__ ((__aligned__(16))) = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19}; + __attribute__ ((noinline)) int main1 () { int i; float a[N] __attribute__ ((__aligned__(16))); - float b[N] __attribute__ ((__aligned__(16))) = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57}; - float c[N] __attribute__ ((__aligned__(16))) = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19}; float *pa = a; float *pb = b; float *pc = c; diff --git a/gcc/testsuite/gcc.dg/vect/vect-58.c b/gcc/testsuite/gcc.dg/vect/vect-58.c index 94cc3ef..fe58860 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-58.c +++ b/gcc/testsuite/gcc.dg/vect/vect-58.c @@ -26,11 +26,12 @@ void bar (float *pa, float *pb, float *pc) vect-54.c is similar to this one with one difference: the loop bound is known. */ +float a[N] __attribute__ ((__aligned__(16))); float b[N] __attribute__ ((__aligned__(16))) = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57}; float c[N] __attribute__ ((__aligned__(16))) = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19}; + __attribute__ ((noinline)) int main1 (int n) { int i; - float a[N] __attribute__ ((__aligned__(16))); float b[N] __attribute__ ((__aligned__(16))) = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57}; float c[N] __attribute__ ((__aligned__(16))) = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19}; float *pa = a; float *pb = b; float *pc = c; diff --git a/gcc/testsuite/gcc.dg/vect/vect-60.c b/gcc/testsuite/gcc.dg/vect/vect-60.c index 97e614c..efb1d50 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-60.c +++ b/gcc/testsuite/gcc.dg/vect/vect-60.c @@ -30,13 +30,14 @@ void bar (float *pa, float *pb, float *pc) vect-61.c is similar to this one with two differences: aliasing is not a problem, and the write access has unknown alignment. */ +float b[N] __attribute__ ((__aligned__(16))) = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57}; +float c[N] __attribute__ ((__aligned__(16))) = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19}; + __attribute__ ((noinline)) int main1 (int n) { int i; float a[N] __attribute__ ((__aligned__(16))); - float b[N] __attribute__ ((__aligned__(16))) = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57}; - float c[N] __attribute__ ((__aligned__(16))) = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19}; float *pa = a; float *pb = b; float *pc = c; diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 07a46df..2255ea1 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -3697,11 +3697,8 @@ verify_gimple_assign_single (gimple stmt) return true; } - if (!one_pointer_to_useless_type_conversion_p (lhs_type, TREE_TYPE (op)) - /* FIXME: a longstanding wart, &a == &a[0]. */ - && (TREE_CODE (TREE_TYPE (op)) != ARRAY_TYPE - || !one_pointer_to_useless_type_conversion_p (lhs_type, - TREE_TYPE (TREE_TYPE (op))))) + if (!one_pointer_to_useless_type_conversion_p (lhs_type, + TREE_TYPE (op))) { error ("type mismatch in address expression"); debug_generic_stmt (lhs_type); |