From: Richard Biener Date: Thu, 20 Nov 2014 09:26:48 +0000 (+0000) Subject: re PR tree-optimization/63962 ([x86] Code pessimization after r217213) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e6121733d569202d5e790c1e085c852748364f99;p=gcc.git re PR tree-optimization/63962 ([x86] Code pessimization after r217213) 2014-11-20 Richard Biener 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 56668b06272..2a4d0099884 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2014-11-20 Richard Biener + + 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 PR tree-optimization/63677 diff --git a/gcc/match.pd b/gcc/match.pd index 1f204716d1c..01f610c6b6f 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 2e637f0c81a..853a83b52bc 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-11-20 Richard Biener + + PR middle-end/63962 + * gcc.dg/tree-ssa/forwprop-30.c: New testcase. + 2014-11-20 Richard Biener 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 00000000000..96554f2c70a --- /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" } } */