diff options
author | Richard Biener <rguenther@suse.de> | 2014-11-20 09:26:48 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2014-11-20 09:26:48 +0000 |
commit | e6121733d569202d5e790c1e085c852748364f99 (patch) | |
tree | 9922d9c8cb2ed3b5af82ccc946330f23519ebf59 | |
parent | b00734dfd64b2014140f84b821d1fdcd4a53affe (diff) | |
download | gcc-e6121733d569202d5e790c1e085c852748364f99.zip gcc-e6121733d569202d5e790c1e085c852748364f99.tar.gz gcc-e6121733d569202d5e790c1e085c852748364f99.tar.bz2 |
re PR tree-optimization/63962 ([x86] Code pessimization after r217213)
2014-11-20 Richard Biener <rguenther@suse.de>
PR middle-end/63962
* match.pd ((p +p off1) +p off2 -> (p +p (off1 + off2))):
Guard with single-use operand 0.
* gcc.dg/tree-ssa/forwprop-30.c: New testcase.
From-SVN: r217828
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/match.pd | 5 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/tree-ssa/forwprop-30.c | 15 |
4 files changed, 29 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 56668b0..2a4d009 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2014-11-20 Richard Biener <rguenther@suse.de> + + PR middle-end/63962 + * match.pd ((p +p off1) +p off2 -> (p +p (off1 + off2))): + Guard with single-use operand 0. + 2014-11-20 Richard Biener <rguenther@suse.de> PR tree-optimization/63677 diff --git a/gcc/match.pd b/gcc/match.pd index 1f20471..01f610c 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -370,8 +370,9 @@ along with GCC; see the file COPYING3. If not see /* Associate (p +p off1) +p off2 as (p +p (off1 + off2)). */ (simplify - (pointer_plus (pointer_plus @0 @1) @3) - (pointer_plus @0 (plus @1 @3))) + (pointer_plus (pointer_plus@2 @0 @1) @3) + (if (TREE_CODE (@2) != SSA_NAME || has_single_use (@2)) + (pointer_plus @0 (plus @1 @3)))) /* Pattern match tem1 = (long) ptr1; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2e637f0..853a83b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-11-20 Richard Biener <rguenther@suse.de> + + PR middle-end/63962 + * gcc.dg/tree-ssa/forwprop-30.c: New testcase. + 2014-11-20 Richard Biener <rguenther@suse.de> PR tree-optimization/63677 diff --git a/gcc/testsuite/gcc.dg/tree-ssa/forwprop-30.c b/gcc/testsuite/gcc.dg/tree-ssa/forwprop-30.c new file mode 100644 index 0000000..96554f2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/forwprop-30.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fdump-tree-optimized" } */ + +int *p; +int *foo (int *q, int i, int j) +{ + p = q + i; + return p + j; +} + +/* We shouldn't associate (q + i) + j to q + (i + j) here as we + need q + i as well. */ + +/* { dg-final { scan-tree-dump-times "\\+" 2 "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ |