public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/79201] missed optimization: sinking doesn't handle calls, swap PRE and sinking
       [not found] <bug-79201-4@http.gcc.gnu.org/bugzilla/>
@ 2021-06-11 10:12 ` drraph at gmail dot com
  2021-09-11  7:04 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 4+ messages in thread
From: drraph at gmail dot com @ 2021-06-11 10:12 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Raphael C <drraph at gmail dot com> ---
I can confirm you now get

f:
        mov     eax, 1
        ret

with gcc 8 onwards.

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

* [Bug tree-optimization/79201] missed optimization: sinking doesn't handle calls, swap PRE and sinking
       [not found] <bug-79201-4@http.gcc.gnu.org/bugzilla/>
  2021-06-11 10:12 ` [Bug tree-optimization/79201] missed optimization: sinking doesn't handle calls, swap PRE and sinking drraph at gmail dot com
@ 2021-09-11  7:04 ` pinskia at gcc dot gnu.org
  2024-06-06 10:59 ` drraph at gmail dot com
  2024-06-06 11:08 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-09-11  7:04 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |NEW
           Severity|normal                      |enhancement
         Resolution|FIXED                       |---

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
So this is actually still broken in the sense if we turn off dominator
optimizations (-fno-tree-dominator-opts), the problem with PRE and sink
interaction comes into play still.

The improvement came in via r8-2694 which in fact added
-fno-tree-dominator-opts to gcc.dg/tree-ssa/ssa-sink-16.c .
Note DOM actually does the sinking rather than the rotating of the loop.

here is a testcase where DOM does not mess with the loop but we should still be
able to sink the function out and do when adding  -fno-tree-pre:

int f(int n, int t) {
  int i,j=0;
  if (t >=31 || t < 0)  return 100;

  for (i = 0; i < t; i++) {
    j = __builtin_ffs(i);
  }
  return j;
}

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

* [Bug tree-optimization/79201] missed optimization: sinking doesn't handle calls, swap PRE and sinking
       [not found] <bug-79201-4@http.gcc.gnu.org/bugzilla/>
  2021-06-11 10:12 ` [Bug tree-optimization/79201] missed optimization: sinking doesn't handle calls, swap PRE and sinking drraph at gmail dot com
  2021-09-11  7:04 ` pinskia at gcc dot gnu.org
@ 2024-06-06 10:59 ` drraph at gmail dot com
  2024-06-06 11:08 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 4+ messages in thread
From: drraph at gmail dot com @ 2024-06-06 10:59 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Raphael C <drraph at gmail dot com> ---
As of gcc 8 this returns:

f(int):
        mov     eax, 1
        ret

I think this can be closed as resolved now.

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

* [Bug tree-optimization/79201] missed optimization: sinking doesn't handle calls, swap PRE and sinking
       [not found] <bug-79201-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2024-06-06 10:59 ` drraph at gmail dot com
@ 2024-06-06 11:08 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-06-06 11:08 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #6)
> here is a testcase where DOM does not mess with the loop but we should still
> be able to sink the function out and do when adding  -fno-tree-pre:
> 
> int f(int n, int t) {
>   int i,j=0;
>   if (t >=31 || t < 0)  return 100;
> 
>   for (i = 0; i < t; i++) {
>     j = __builtin_ffs(i);
>   }
>   return j;
> }

Note in GCC 12+, you need  -fno-tree-vectorize to get the bad behavior back.

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

end of thread, other threads:[~2024-06-06 11:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-79201-4@http.gcc.gnu.org/bugzilla/>
2021-06-11 10:12 ` [Bug tree-optimization/79201] missed optimization: sinking doesn't handle calls, swap PRE and sinking drraph at gmail dot com
2021-09-11  7:04 ` pinskia at gcc dot gnu.org
2024-06-06 10:59 ` drraph at gmail dot com
2024-06-06 11:08 ` pinskia 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).