public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/20514] New: hoisting of label out of jumptable would take place at cse, should happen at trees
@ 2005-03-17  8:21 aoliva at gcc dot gnu dot org
  2005-03-17 17:23 ` [Bug tree-optimization/20514] " pinskia at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: aoliva at gcc dot gnu dot org @ 2005-03-17  8:21 UTC (permalink / raw)
  To: gcc-bugs

The following testcase from bug 18628 exposes a case in which cse would have
folded a load from a jump table into a label.  Jeff suspects this should have
happened earlier, in the tree level, so he asked me to file this bug.  Here's
the testcase:

int i;
int main()
{
  for (;;)
  {
    switch (i)
    {
      case 0:
      case 1:
        return 1;

      case 2:
      case 3:
        return 0;

      case 5:
        --i;
    }
  }
}

-- 
           Summary: hoisting of label out of jumptable would take place at
                    cse, should happen at trees
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: tree-optimization
        AssignedTo: law at gcc dot gnu dot org
        ReportedBy: aoliva at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org
OtherBugsDependingO 19721
             nThis:


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


^ permalink raw reply	[flat|nested] 5+ 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: hoisting of label out of jumptable would take place at cse, should happen at trees 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; 5+ 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] 5+ 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: hoisting of label out of jumptable would take place at cse, should happen at trees 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; 5+ 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] 5+ 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: hoisting of label out of jumptable would take place at cse, should happen at trees 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; 5+ 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] 5+ 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: hoisting of label out of jumptable would take place at cse, should happen at trees 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; 5+ 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] 5+ messages in thread

end of thread, other threads:[~2005-05-06 13:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-17  8:21 [Bug tree-optimization/20514] New: hoisting of label out of jumptable would take place at cse, should happen at trees 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).