public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/63962] New: [5 Regression][x86] Code pessimization after r217213
@ 2014-11-19 12:56 izamyatin at gmail dot com
  2014-11-19 13:30 ` [Bug tree-optimization/63962] " rguenth at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: izamyatin at gmail dot com @ 2014-11-19 12:56 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63962

            Bug ID: 63962
           Summary: [5 Regression][x86] Code pessimization after r217213
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: izamyatin at gmail dot com
            Target: x86

While investigating some performance regressions on 32 bits on trunk (just -O2
-m32) I noticed that after r217213 forward propagation makes code worse for
following testcase

struct TT
{
 int * c;
 int s;
} FF;

long
foo (int t1, int t2)
{
  unsigned int i, i1;
  static int *c, s;

  for (i = 0; i < t1; i++)
    {
      c = FF.c + FF.s - 1;
      s = (int)(*c--);

      for (i1 = 2; i1 < t2; i1++)
    s += (int)(*c--);
    }

  return s;
}

For r217212 I see in 068t.forwprop2

-----
<bb 3>:
  _8 = FF.c;
  _9 = FF.s;
  _10 = (sizetype) _9;
  _11 = _10 + 1073741823;
  _12 = _11 * 4;
  c.0_13 = _8 + _12;
  c = c.0_13;
  c.3_15 = c.0_13 + 4294967292;
  c = c.3_15;
  s.4_17 = *c.0_13;
  s = s.4_17;
  # DEBUG i1 => 2
  goto <bb 5>;
-----

while for r217213 code contains one more addition

-----                                           |
 <bb 3>:                                        |
  _8 = FF.c;                                    |
  _9 = FF.s;                                    |
  _10 = (sizetype) _9;                          |
  _11 = _10 + 1073741823;                       |
  _12 = _11 * 4;                                |
  c.0_13 = _8 + _12;                            |
  c = c.0_13;                                   |
  _31 = _12 + 4294967292;    <-------------------
  c.3_15 = _8 + _31;
  c = c.3_15;
  s.4_17 = *c.0_13;
  s = s.4_17;
  # DEBUG i1 => 2
  goto <bb 5>;

-----


Can try to cook runtime test if it is necessary.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug tree-optimization/63962] [5 Regression][x86] Code pessimization after r217213
  2014-11-19 12:56 [Bug tree-optimization/63962] New: [5 Regression][x86] Code pessimization after r217213 izamyatin at gmail dot com
@ 2014-11-19 13:30 ` rguenth at gcc dot gnu.org
  2014-11-19 14:23 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-11-19 13:30 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63962

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |5.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug tree-optimization/63962] [5 Regression][x86] Code pessimization after r217213
  2014-11-19 12:56 [Bug tree-optimization/63962] New: [5 Regression][x86] Code pessimization after r217213 izamyatin at gmail dot com
  2014-11-19 13:30 ` [Bug tree-optimization/63962] " rguenth at gcc dot gnu.org
@ 2014-11-19 14:23 ` rguenth at gcc dot gnu.org
  2014-11-20  9:27 ` rguenth at gcc dot gnu.org
  2014-11-20  9:27 ` rguenth at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-11-19 14:23 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63962

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2014-11-19
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.  I missed a !has_single_use when converting this pattern:

  /* Associate (p +p off1) +p off2 as (p +p (off1 + off2)).  */
  ptr = gimple_assign_rhs1 (stmt);
  off1 = gimple_assign_rhs2 (stmt);
  if (TREE_CODE (ptr) != SSA_NAME
      || !has_single_use (ptr))
    return false;


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug tree-optimization/63962] [5 Regression][x86] Code pessimization after r217213
  2014-11-19 12:56 [Bug tree-optimization/63962] New: [5 Regression][x86] Code pessimization after r217213 izamyatin at gmail dot com
                   ` (2 preceding siblings ...)
  2014-11-20  9:27 ` rguenth at gcc dot gnu.org
@ 2014-11-20  9:27 ` rguenth at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-11-20  9:27 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63962

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug tree-optimization/63962] [5 Regression][x86] Code pessimization after r217213
  2014-11-19 12:56 [Bug tree-optimization/63962] New: [5 Regression][x86] Code pessimization after r217213 izamyatin at gmail dot com
  2014-11-19 13:30 ` [Bug tree-optimization/63962] " rguenth at gcc dot gnu.org
  2014-11-19 14:23 ` rguenth at gcc dot gnu.org
@ 2014-11-20  9:27 ` rguenth at gcc dot gnu.org
  2014-11-20  9:27 ` rguenth at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-11-20  9:27 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63962

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
Author: rguenth
Date: Thu Nov 20 09:26:48 2014
New Revision: 217828

URL: https://gcc.gnu.org/viewcvs?rev=217828&root=gcc&view=rev
Log:
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.

Added:
    trunk/gcc/testsuite/gcc.dg/tree-ssa/forwprop-30.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/match.pd
    trunk/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-11-20  9:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-19 12:56 [Bug tree-optimization/63962] New: [5 Regression][x86] Code pessimization after r217213 izamyatin at gmail dot com
2014-11-19 13:30 ` [Bug tree-optimization/63962] " rguenth at gcc dot gnu.org
2014-11-19 14:23 ` rguenth at gcc dot gnu.org
2014-11-20  9:27 ` rguenth at gcc dot gnu.org
2014-11-20  9:27 ` rguenth at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).