public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/20514] hoisting of label out of jumptable would take place at cse, should happen at trees
       [not found] <bug-20514-4@http.gcc.gnu.org/bugzilla/>
@ 2021-05-04 12:31 ` rguenth at gcc dot gnu.org
  2021-07-24  5:17 ` pinskia at gcc dot gnu.org
  2023-08-05  3:09 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-05-04 12:31 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED

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

* [Bug tree-optimization/20514] hoisting of label out of jumptable would take place at cse, should happen at trees
       [not found] <bug-20514-4@http.gcc.gnu.org/bugzilla/>
  2021-05-04 12:31 ` [Bug tree-optimization/20514] hoisting of label out of jumptable would take place at cse, should happen at trees rguenth at gcc dot gnu.org
@ 2021-07-24  5:17 ` pinskia at gcc dot gnu.org
  2023-08-05  3:09 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-07-24  5:17 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note I noticed gimple loop code invariant motion is causing comment #0 to be
really bad.

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

* [Bug tree-optimization/20514] hoisting of label out of jumptable would take place at cse, should happen at trees
       [not found] <bug-20514-4@http.gcc.gnu.org/bugzilla/>
  2021-05-04 12:31 ` [Bug tree-optimization/20514] hoisting of label out of jumptable would take place at cse, should happen at trees rguenth at gcc dot gnu.org
  2021-07-24  5:17 ` pinskia at gcc dot gnu.org
@ 2023-08-05  3:09 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-08-05  3:09 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
in GCC 13+ we get now (for the testcase in comment #0) at -O3:
```
  <bb 4> [local count: 452984831]:
  # i_lsm.4_2 = PHI <i_lsm.4_11(3), 4(4)>
  if (i_lsm.4_2 == 5)
    goto <bb 4>; [25.00%]
  else
    goto <bb 5>; [75.00%]

  <bb 5> [local count: 452984832]:
  goto <bb 5>; [100.00%]
```
This is an infinite no matter which branch is taken ...
Coming in we get either `3->4->4->5` or `3->4->5` no matter what we end up in 5
always.

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

* [Bug tree-optimization/20514] hoisting of label out of jumptable would take place at cse, should happen at trees
       [not found] <bug-20514-334@http.gcc.gnu.org/bugzilla/>
  2006-09-17  8:00 ` pinskia at gcc dot gnu dot org
@ 2007-12-14 15:01 ` aldot at gcc dot gnu dot org
  1 sibling, 0 replies; 9+ messages in thread
From: aldot at gcc dot gnu dot org @ 2007-12-14 15:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from aldot at gcc dot gnu dot org  2007-12-14 15:00 -------
Still present on current trunk (20071214).
This used to work with 3.4.6:
.L14:
        cmpl    $5, %eax
        ja      .L14
        .ident  "GCC: (GNU) 3.4.6 (Debian 3.4.6-6)"

Not quite optimal though since this would be even better:
.L14:
        cmpl $5,%eax
        ja .L4711
.L4711:
        jmp .L4711
(or something to that effect).


-- 

aldot at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |aldot at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20514


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

* [Bug tree-optimization/20514] hoisting of label out of jumptable would take place at cse, should happen at trees
       [not found] <bug-20514-334@http.gcc.gnu.org/bugzilla/>
@ 2006-09-17  8:00 ` pinskia at gcc dot gnu dot org
  2007-12-14 15:01 ` aldot at gcc dot gnu dot org
  1 sibling, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-09-17  8:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pinskia at gcc dot gnu dot org  2006-09-17 07:59 -------
(In reply to comment #2)
> Two things, we just don't jump thread.
The testcase mentioned in comment #2 is fixed but we still don't make an
infinite loop for the orginal case:
<L9>:;
  switch (i_lsm.25)
    {
      case 0 ... 1: goto <L1>;
      case 2 ... 3: goto <L12>;
      case 5: goto <L5>;
      default : goto <L9>;
    }
<L5>:;
  i_lsm.25 = 4;
  goto <bb 3> (<L9>);
...
Which is obvious an infinite loop but we still go through the switch every
time.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2006-01-21 03:00:56         |2006-09-17 07:59:49
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20514


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

* [Bug tree-optimization/20514] hoisting of label out of jumptable would take place at cse, should happen at trees
  2005-03-17  8:21 [Bug tree-optimization/20514] New: " aoliva at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2005-05-06  8:50 ` steven at gcc dot gnu dot org
@ 2005-05-06 13:40 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-06 13:40 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-05-06 13:39 -------
(In reply to comment #3)
> Can someone explain what is expected here?  I get the following .optimized 

This is what it should look like instead:
main () 
{ 
  int lsm_tmp.1; 
  int D.1572; 
  int D.1571; 
  int i.0; 
 
<L8>:; 
  lsm_tmp.1 = i; 
  goto <bb 2> (<L10>); 
 
<L9>:; 
  goto <L9>;
 
<L10>:; 
  switch (lsm_tmp.1) 
    { 
      case 0 ... 1: goto <L1>; 
      case 2 ... 3: goto <L13>; 
      case 5: goto <L5>; 
      default : goto <L9>; 
    } 
 
<L1>:; 
  i = lsm_tmp.1; 
  D.1571 = 1; 
  goto <bb 6> (<L7>); 
 
<L5>:; 
  lsm_tmp.1 = 4; 
  goto <bb 1> (<L9>); 
 
<L13>:; 
  i = lsm_tmp.1; 
  D.1571 = 0; 
 
<L7>:; 
  return D.1571; 
 
} 

So we should get an infinite loop for L9 because there is no way lsm_tmp.1 can change.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20514


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

* [Bug tree-optimization/20514] hoisting of label out of jumptable would take place at cse, should happen at trees
  2005-03-17  8:21 [Bug tree-optimization/20514] New: " aoliva at gcc dot gnu dot org
  2005-03-17 17:23 ` [Bug tree-optimization/20514] " pinskia at gcc dot gnu dot org
  2005-04-13 18:30 ` pinskia at gcc dot gnu dot org
@ 2005-05-06  8:50 ` steven at gcc dot gnu dot org
  2005-05-06 13:40 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 9+ messages in thread
From: steven at gcc dot gnu dot org @ 2005-05-06  8:50 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From steven at gcc dot gnu dot org  2005-05-06 08:50 -------
Can someone explain what is expected here?  I get the following .optimized 
dump: 
 
main () 
{ 
  int lsm_tmp.1; 
  int D.1572; 
  int D.1571; 
  int i.0; 
 
<L8>:; 
  lsm_tmp.1 = i; 
  goto <bb 2> (<L10>); 
 
<L9>:; 
 
<L10>:; 
  switch (lsm_tmp.1) 
    { 
      case 0 ... 1: goto <L1>; 
      case 2 ... 3: goto <L13>; 
      case 5: goto <L5>; 
      default : goto <L9>; 
    } 
 
<L1>:; 
  i = lsm_tmp.1; 
  D.1571 = 1; 
  goto <bb 6> (<L7>); 
 
<L5>:; 
  lsm_tmp.1 = 4; 
  goto <bb 1> (<L9>); 
 
<L13>:; 
  i = lsm_tmp.1; 
  D.1571 = 0; 
 
<L7>:; 
  return D.1571; 
 
} 
 

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20514


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

* [Bug tree-optimization/20514] hoisting of label out of jumptable would take place at cse, should happen at trees
  2005-03-17  8:21 [Bug tree-optimization/20514] New: " aoliva at gcc dot gnu dot org
  2005-03-17 17:23 ` [Bug tree-optimization/20514] " pinskia at gcc dot gnu dot org
@ 2005-04-13 18:30 ` pinskia at gcc dot gnu dot org
  2005-05-06  8:50 ` steven at gcc dot gnu dot org
  2005-05-06 13:40 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-04-13 18:30 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-04-13 18:30 -------
Two things, we just don't jump thread.
Another testcase:
int i;
int main()
{
  for (;;)
  {
    switch (i)
    {
      case 5:
        i = 4;
        break;
      default:
        return 0;
    }
  }
}

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20514


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

* [Bug tree-optimization/20514] hoisting of label out of jumptable would take place at cse, should happen at trees
  2005-03-17  8:21 [Bug tree-optimization/20514] New: " aoliva at gcc dot gnu dot org
@ 2005-03-17 17:23 ` pinskia at gcc dot gnu dot org
  2005-04-13 18:30 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-03-17 17:23 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-03-17 17:23 -------
Confirmed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |missed-optimization, TREE
   Last reconfirmed|0000-00-00 00:00:00         |2005-03-17 17:23:27
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20514


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

end of thread, other threads:[~2023-08-05  3:09 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-20514-4@http.gcc.gnu.org/bugzilla/>
2021-05-04 12:31 ` [Bug tree-optimization/20514] hoisting of label out of jumptable would take place at cse, should happen at trees rguenth at gcc dot gnu.org
2021-07-24  5:17 ` pinskia at gcc dot gnu.org
2023-08-05  3:09 ` pinskia at gcc dot gnu.org
     [not found] <bug-20514-334@http.gcc.gnu.org/bugzilla/>
2006-09-17  8:00 ` pinskia at gcc dot gnu dot org
2007-12-14 15:01 ` aldot at gcc dot gnu dot org
2005-03-17  8:21 [Bug tree-optimization/20514] New: " aoliva at gcc dot gnu dot org
2005-03-17 17:23 ` [Bug tree-optimization/20514] " pinskia at gcc dot gnu dot org
2005-04-13 18:30 ` pinskia at gcc dot gnu dot org
2005-05-06  8:50 ` steven at gcc dot gnu dot org
2005-05-06 13:40 ` pinskia at gcc dot gnu dot 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).