diff options
author | Jakub Jelinek <jakub@redhat.com> | 2011-10-04 14:34:06 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2011-10-04 14:34:06 +0200 |
commit | f548a3173e47b45bf132c533091c8776ca79b629 (patch) | |
tree | e03429ddfdb28c26c0b8a6b943ec84b3196db8b1 /gcc/testsuite/gcc.dg/tree-ssa/restrict-4.c | |
parent | 8cba60274732940251f0cd65af9f2d3b6f7b7e18 (diff) | |
download | gcc-f548a3173e47b45bf132c533091c8776ca79b629.zip gcc-f548a3173e47b45bf132c533091c8776ca79b629.tar.gz gcc-f548a3173e47b45bf132c533091c8776ca79b629.tar.bz2 |
fold-const.c (fold_unary_loc): Don't optimize POINTER_PLUS_EXPR casted to TYPE_RESTRICT pointer by casting the...
* fold-const.c (fold_unary_loc): Don't optimize
POINTER_PLUS_EXPR casted to TYPE_RESTRICT pointer by
casting the inner pointer if it isn't TYPE_RESTRICT.
* tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Don't through
casts from non-TYPE_RESTRICT pointer to TYPE_RESTRICT pointer.
* gcc.dg/tree-ssa/restrict-4.c: New test.
From-SVN: r179500
Diffstat (limited to 'gcc/testsuite/gcc.dg/tree-ssa/restrict-4.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/tree-ssa/restrict-4.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/restrict-4.c b/gcc/testsuite/gcc.dg/tree-ssa/restrict-4.c new file mode 100644 index 0000000..a307c89 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/restrict-4.c @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ + +int +foo (int *x, int y) +{ + int *__restrict p1 = x; + int *__restrict p2 = x + 32; + p1[y] = 1; + p2[4] = 2; + return p1[y]; +} + +int +bar (int *x, int y) +{ + int *__restrict p1 = x; + int *p3 = x + 32; + int *__restrict p2 = p3; + p1[y] = 1; + p2[4] = 2; + return p1[y]; +} + +/* { dg-final { scan-tree-dump-times "return 1;" 2 "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ |