public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/113714] New: [11/12/13/14 Regression] Missed optimization for redundancy computation elimination: -(w+d-x)-x => -(w+d)
@ 2024-02-02  8:31 652023330028 at smail dot nju.edu.cn
  2024-02-04  5:32 ` [Bug tree-optimization/113714] " pinskia at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: 652023330028 at smail dot nju.edu.cn @ 2024-02-02  8:31 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 113714
           Summary: [11/12/13/14 Regression] Missed optimization for
                    redundancy computation elimination: -(w+d-x)-x =>
                    -(w+d)
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: 652023330028 at smail dot nju.edu.cn
  Target Milestone: ---

Hello, we noticed that x can be eliminated from the calculation of z in the
following code:
c-x => -(w+d-x)-x => -(w+d)

https://godbolt.org/z/MYhGTc4Pv

int x,y,z,w;
void func(int a, int b, int c, int d){
    x=a/b - y;
    c=-(w+d-x);
    z=c-x;
}

But GCC -O3 -fwrapv:
  _1 = a_7(D) / b_8(D);
  y.0_2 = y;
  _3 = _1 - y.0_2;
  x = _3;

  #Here is the part related to the calculation of z:
  w.2_4 = w;
  _20 = y.0_2 - w.2_4;
  _21 = _20 - d_11(D);
  _22 = _3 + _21;
  _6 = _22 - _1;
  z = _6;
  return;

Expected code:
GCC-10.5 -O3 -fwrapv
  _1 = a_7(D) / b_8(D);
  y.0_2 = y;
  _3 = _1 - y.0_2;
  x = _3;

  #Here is the part related to the calculation of z:
  w.2_4 = w;
  _5 = w.2_4 + d_11(D);
  _6 = -_5;
  z = _6;
  return;

Thank you very much for your time and effort! We look forward to hearing from
you.

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

* [Bug tree-optimization/113714] [11/12/13/14 Regression] Missed optimization for redundancy computation elimination: -(w+d-x)-x => -(w+d)
  2024-02-02  8:31 [Bug tree-optimization/113714] New: [11/12/13/14 Regression] Missed optimization for redundancy computation elimination: -(w+d-x)-x => -(w+d) 652023330028 at smail dot nju.edu.cn
@ 2024-02-04  5:32 ` pinskia at gcc dot gnu.org
  2024-02-04  5:34 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-02-04  5:32 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2024-02-04
   Target Milestone|---                         |11.5
           Keywords|                            |needs-bisection
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.

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

* [Bug tree-optimization/113714] [11/12/13/14 Regression] Missed optimization for redundancy computation elimination: -(w+d-x)-x => -(w+d)
  2024-02-02  8:31 [Bug tree-optimization/113714] New: [11/12/13/14 Regression] Missed optimization for redundancy computation elimination: -(w+d-x)-x => -(w+d) 652023330028 at smail dot nju.edu.cn
  2024-02-04  5:32 ` [Bug tree-optimization/113714] " pinskia at gcc dot gnu.org
@ 2024-02-04  5:34 ` pinskia at gcc dot gnu.org
  2024-02-11 15:20 ` pheeck at gcc dot gnu.org
  2024-03-07 20:42 ` law at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-02-04  5:34 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|11.1.0                      |

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Hmm, for x86_64, it regressed in GCC 11 but for aarch64, it seems like it is
only a regression on the trunk ...

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

* [Bug tree-optimization/113714] [11/12/13/14 Regression] Missed optimization for redundancy computation elimination: -(w+d-x)-x => -(w+d)
  2024-02-02  8:31 [Bug tree-optimization/113714] New: [11/12/13/14 Regression] Missed optimization for redundancy computation elimination: -(w+d-x)-x => -(w+d) 652023330028 at smail dot nju.edu.cn
  2024-02-04  5:32 ` [Bug tree-optimization/113714] " pinskia at gcc dot gnu.org
  2024-02-04  5:34 ` pinskia at gcc dot gnu.org
@ 2024-02-11 15:20 ` pheeck at gcc dot gnu.org
  2024-03-07 20:42 ` law at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: pheeck at gcc dot gnu.org @ 2024-02-11 15:20 UTC (permalink / raw)
  To: gcc-bugs

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

Filip Kastl <pheeck at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |aldyh at redhat dot com,
                   |                            |pheeck at gcc dot gnu.org

--- Comment #3 from Filip Kastl <pheeck at gcc dot gnu.org> ---
For x86_64, I've bisected the regression to r11-1146-g1396fa5b91cfa0

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

* [Bug tree-optimization/113714] [11/12/13/14 Regression] Missed optimization for redundancy computation elimination: -(w+d-x)-x => -(w+d)
  2024-02-02  8:31 [Bug tree-optimization/113714] New: [11/12/13/14 Regression] Missed optimization for redundancy computation elimination: -(w+d-x)-x => -(w+d) 652023330028 at smail dot nju.edu.cn
                   ` (2 preceding siblings ...)
  2024-02-11 15:20 ` pheeck at gcc dot gnu.org
@ 2024-03-07 20:42 ` law at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: law at gcc dot gnu.org @ 2024-03-07 20:42 UTC (permalink / raw)
  To: gcc-bugs

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

Jeffrey A. Law <law at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2
                 CC|                            |law at gcc dot gnu.org

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

end of thread, other threads:[~2024-03-07 20:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-02  8:31 [Bug tree-optimization/113714] New: [11/12/13/14 Regression] Missed optimization for redundancy computation elimination: -(w+d-x)-x => -(w+d) 652023330028 at smail dot nju.edu.cn
2024-02-04  5:32 ` [Bug tree-optimization/113714] " pinskia at gcc dot gnu.org
2024-02-04  5:34 ` pinskia at gcc dot gnu.org
2024-02-11 15:20 ` pheeck at gcc dot gnu.org
2024-03-07 20:42 ` law 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).