public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/106210] New: missing shrink wrap for simple case
@ 2022-07-05 22:39 pinskia at gcc dot gnu.org
  2022-07-05 22:43 ` [Bug rtl-optimization/106210] [10/11/12/13 Regression] " pinskia at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-07-05 22:39 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 106210
           Summary: missing shrink wrap for simple case
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---
            Target: aarch64-*-* x86_64-*-*

Take:
```
int f(int);

int advance(int dz)
{
    int dz1;
    if (dz > 0)
        return (dz + dz) * dz;
    else
        return dz * f(dz);
}
```
I would have expected this to be shrink wrapped but it is not.

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

* [Bug rtl-optimization/106210] [10/11/12/13 Regression] missing shrink wrap for simple case
  2022-07-05 22:39 [Bug rtl-optimization/106210] New: missing shrink wrap for simple case pinskia at gcc dot gnu.org
@ 2022-07-05 22:43 ` pinskia at gcc dot gnu.org
  2022-07-05 22:48 ` pinskia at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-07-05 22:43 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|missing shrink wrap for     |[10/11/12/13 Regression]
                   |simple case                 |missing shrink wrap for
                   |                            |simple case
      Known to fail|                            |9.1.0
      Known to work|                            |5.4.0
   Target Milestone|---                         |10.5

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This is interesting because for aarch64 the shrink wrapping started to fail in
GCC 6 while for x86_64, the shrink wrapping started to fail in GCC 9 (most
likely due to r265398).

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

* [Bug rtl-optimization/106210] [10/11/12/13 Regression] missing shrink wrap for simple case
  2022-07-05 22:39 [Bug rtl-optimization/106210] New: missing shrink wrap for simple case pinskia at gcc dot gnu.org
  2022-07-05 22:43 ` [Bug rtl-optimization/106210] [10/11/12/13 Regression] " pinskia at gcc dot gnu.org
@ 2022-07-05 22:48 ` pinskia at gcc dot gnu.org
  2022-07-15  8:36 ` marxin at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-07-05 22:48 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |needs-bisection

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note the following is still shink wrapped on x86_64 but is not on aarch64 (the
only difference is using double instead of int) and it broke in GCC 6 for
aarch64 just as the int case:


double f(double );

double advance(double dz)
{
    int dz1;
    if (dz > 0)
        return (dz + dz) * dz;
    else
        return dz * f(dz);
}

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

* [Bug rtl-optimization/106210] [10/11/12/13 Regression] missing shrink wrap for simple case
  2022-07-05 22:39 [Bug rtl-optimization/106210] New: missing shrink wrap for simple case pinskia at gcc dot gnu.org
  2022-07-05 22:43 ` [Bug rtl-optimization/106210] [10/11/12/13 Regression] " pinskia at gcc dot gnu.org
  2022-07-05 22:48 ` pinskia at gcc dot gnu.org
@ 2022-07-15  8:36 ` marxin at gcc dot gnu.org
  2022-07-15 19:32 ` pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-07-15  8:36 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
     Ever confirmed|0                           |1
                 CC|                            |marxin at gcc dot gnu.org
   Last reconfirmed|                            |2022-07-15

--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
@Andrew: Can you please help me how to identify if shrink wrapping happens or
not?

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

* [Bug rtl-optimization/106210] [10/11/12/13 Regression] missing shrink wrap for simple case
  2022-07-05 22:39 [Bug rtl-optimization/106210] New: missing shrink wrap for simple case pinskia at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2022-07-15  8:36 ` marxin at gcc dot gnu.org
@ 2022-07-15 19:32 ` pinskia at gcc dot gnu.org
  2022-07-18  8:00 ` [Bug rtl-optimization/106210] [10/11/12/13 Regression] missing shrink wrap for simple case since r9-3594-g8d2d39587d941a40 marxin at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-07-15 19:32 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
By using the dump file:
-fdump-rtl-pro_and_epologue

You will see if it was shrink wrapped (which it does in GCC 5.x):
Performing shrink-wrapping.

While the full dump in GCC 6 has:
Attempting shrink-wrapping optimization.
Block 2 needs the prologue.
Block 4 needs the prologue.
After wrapping required blocks, PRO is now 2
Avoiding non-duplicatable blocks, PRO is now 2
Bumping back to anticipatable blocks, PRO is now 2


Here is the part of the dump for GCC 5 which shows the full thing:
Attempting shrink-wrapping optimization.
insn 6: replaced reg 1 with 0
rescanning insn with uid = 6.
Found candidate edge for shrink-wrapping, 2->4.
Performing shrink-wrapping.
changing bb of uid 60
  unscanned insn
Duplicating bb 5 to bb 6, 0 active insns.
scanning new insn with uid = 64.
Removing jump 48.

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

* [Bug rtl-optimization/106210] [10/11/12/13 Regression] missing shrink wrap for simple case since r9-3594-g8d2d39587d941a40
  2022-07-05 22:39 [Bug rtl-optimization/106210] New: missing shrink wrap for simple case pinskia at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2022-07-15 19:32 ` pinskia at gcc dot gnu.org
@ 2022-07-18  8:00 ` marxin at gcc dot gnu.org
  2022-07-18 17:34 ` segher at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-07-18  8:00 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |segher at gcc dot gnu.org
           Keywords|needs-bisection             |
            Summary|[10/11/12/13 Regression]    |[10/11/12/13 Regression]
                   |missing shrink wrap for     |missing shrink wrap for
                   |simple case                 |simple case since
                   |                            |r9-3594-g8d2d39587d941a40

--- Comment #5 from Martin Liška <marxin at gcc dot gnu.org> ---
All right, then it started with r9-3594-g8d2d39587d941a40.

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

* [Bug rtl-optimization/106210] [10/11/12/13 Regression] missing shrink wrap for simple case since r9-3594-g8d2d39587d941a40
  2022-07-05 22:39 [Bug rtl-optimization/106210] New: missing shrink wrap for simple case pinskia at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2022-07-18  8:00 ` [Bug rtl-optimization/106210] [10/11/12/13 Regression] missing shrink wrap for simple case since r9-3594-g8d2d39587d941a40 marxin at gcc dot gnu.org
@ 2022-07-18 17:34 ` segher at gcc dot gnu.org
  2022-10-19 10:36 ` rguenth at gcc dot gnu.org
  2023-07-07 10:43 ` [Bug rtl-optimization/106210] [11/12/13/14 " rguenth at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: segher at gcc dot gnu.org @ 2022-07-18 17:34 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Segher Boessenkool <segher at gcc dot gnu.org> ---
The prepare_shrink_wrap code handles only very limited very simple cases.

After g:8d2d39587d94 there is another copy at this point (which is an
*improvement*, it gives more freedom).  I don't see how this trips up
prepare_shrink_wrap though?

Btw, for rs6000 this is no longer shrink-wrapped in GCC 6 already, long
before that commit.  It saves r3 in r31 then (was r9), and that makes
requires_stack_frame_p return true (because that reg needs to be saved on
the stack before use, being non-volatile and all).

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

* [Bug rtl-optimization/106210] [10/11/12/13 Regression] missing shrink wrap for simple case since r9-3594-g8d2d39587d941a40
  2022-07-05 22:39 [Bug rtl-optimization/106210] New: missing shrink wrap for simple case pinskia at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2022-07-18 17:34 ` segher at gcc dot gnu.org
@ 2022-10-19 10:36 ` rguenth at gcc dot gnu.org
  2023-07-07 10:43 ` [Bug rtl-optimization/106210] [11/12/13/14 " rguenth at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-10-19 10:36 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2

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

* [Bug rtl-optimization/106210] [11/12/13/14 Regression] missing shrink wrap for simple case since r9-3594-g8d2d39587d941a40
  2022-07-05 22:39 [Bug rtl-optimization/106210] New: missing shrink wrap for simple case pinskia at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2022-10-19 10:36 ` rguenth at gcc dot gnu.org
@ 2023-07-07 10:43 ` rguenth at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-07 10:43 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|10.5                        |11.5

--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 10 branch is being closed.

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

end of thread, other threads:[~2023-07-07 10:43 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-05 22:39 [Bug rtl-optimization/106210] New: missing shrink wrap for simple case pinskia at gcc dot gnu.org
2022-07-05 22:43 ` [Bug rtl-optimization/106210] [10/11/12/13 Regression] " pinskia at gcc dot gnu.org
2022-07-05 22:48 ` pinskia at gcc dot gnu.org
2022-07-15  8:36 ` marxin at gcc dot gnu.org
2022-07-15 19:32 ` pinskia at gcc dot gnu.org
2022-07-18  8:00 ` [Bug rtl-optimization/106210] [10/11/12/13 Regression] missing shrink wrap for simple case since r9-3594-g8d2d39587d941a40 marxin at gcc dot gnu.org
2022-07-18 17:34 ` segher at gcc dot gnu.org
2022-10-19 10:36 ` rguenth at gcc dot gnu.org
2023-07-07 10:43 ` [Bug rtl-optimization/106210] [11/12/13/14 " 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).