public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/20656] New: No strength reduction for a simple testcase
@ 2005-03-27 19:13 pinskia at gcc dot gnu dot org
  2005-04-06 18:50 ` [Bug tree-optimization/20656] " pinskia at gcc dot gnu dot org
  2005-07-27 13:56 ` pinskia at gcc dot gnu dot org
  0 siblings, 2 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-03-27 19:13 UTC (permalink / raw)
  To: gcc-bugs

The following two function should be equivalent:
int f(int offset, int len, int num_bytes)
{
int i;
num_bytes = 0;
for (i = 0; i < len; i++) num_bytes ++;
return num_bytes;
}

int f1(int offset, int len, int num_bytes)
{
  if (len<0)
   return 0;
  return len;
}

Why don't we strength reduce the loop in f?
Then we just need to remove the loop and two functions would be equivalent.

The orginal code which was found in real code (I think java code in classpath):
int f(int offset, int len, int num_bytes)
{
  int i;
  for (i = 0; i < len; i++) num_bytes +=2;
  return num_bytes;
}
int f1(int offset, int len, int num_bytes)
{
  if (len<0)
   return num_bytes;
  return num_bytes+len*2;
}

-- 
           Summary: No strength reduction for a simple testcase
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P2
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pinskia at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug tree-optimization/20656] No strength reduction for a simple testcase
  2005-03-27 19:13 [Bug tree-optimization/20656] New: No strength reduction for a simple testcase pinskia at gcc dot gnu dot org
@ 2005-04-06 18:50 ` pinskia at gcc dot gnu dot org
  2005-07-27 13:56 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-04-06 18:50 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-04-06 18:50 -------
Confirmed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2005-04-06 18:50:25
               date|                            |


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


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

* [Bug tree-optimization/20656] No strength reduction for a simple testcase
  2005-03-27 19:13 [Bug tree-optimization/20656] New: No strength reduction for a simple testcase pinskia at gcc dot gnu dot org
  2005-04-06 18:50 ` [Bug tree-optimization/20656] " pinskia at gcc dot gnu dot org
@ 2005-07-27 13:56 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-27 13:56 UTC (permalink / raw)
  To: gcc-bugs



-- 
Bug 20656 depends on bug 22325, which changed state.

Bug 22325 Summary: missed optimization in loop
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22325

           What    |Old Value                   |New Value
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED

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


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

* [Bug tree-optimization/20656] No strength reduction for a simple testcase
       [not found] <bug-20656-6528@http.gcc.gnu.org/bugzilla/>
  2005-11-08  0:30 ` hp at gcc dot gnu dot org
  2005-11-09  3:45 ` hp at gcc dot gnu dot org
@ 2006-02-15 19:14 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-02-15 19:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pinskia at gcc dot gnu dot org  2006-02-15 19:14 -------
Fixed on the mainline now (I don't know what by).


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.2.0


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


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

* [Bug tree-optimization/20656] No strength reduction for a simple testcase
       [not found] <bug-20656-6528@http.gcc.gnu.org/bugzilla/>
  2005-11-08  0:30 ` hp at gcc dot gnu dot org
@ 2005-11-09  3:45 ` hp at gcc dot gnu dot org
  2006-02-15 19:14 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 6+ messages in thread
From: hp at gcc dot gnu dot org @ 2005-11-09  3:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from hp at gcc dot gnu dot org  2005-11-09 03:45 -------
Referring to comment #2, the test-case for PR 24750 has a few similar loops and
a few other PR references that seems relevant.


-- 


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


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

* [Bug tree-optimization/20656] No strength reduction for a simple testcase
       [not found] <bug-20656-6528@http.gcc.gnu.org/bugzilla/>
@ 2005-11-08  0:30 ` hp at gcc dot gnu dot org
  2005-11-09  3:45 ` hp at gcc dot gnu dot org
  2006-02-15 19:14 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 6+ messages in thread
From: hp at gcc dot gnu dot org @ 2005-11-08  0:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from hp at gcc dot gnu dot org  2005-11-08 00:30 -------
Seen at test-case reduction also for code of the form:
int i; for (i = 1; i <= shift_size; i++) { }
not producing the same ICE as for:
int i; i = 1 <= shift_size ? shift_size : 1;
(I'll put a pointer here to the complete test-case in due time.)


-- 

hp at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2006-02-15 19:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-27 19:13 [Bug tree-optimization/20656] New: No strength reduction for a simple testcase pinskia at gcc dot gnu dot org
2005-04-06 18:50 ` [Bug tree-optimization/20656] " pinskia at gcc dot gnu dot org
2005-07-27 13:56 ` pinskia at gcc dot gnu dot org
     [not found] <bug-20656-6528@http.gcc.gnu.org/bugzilla/>
2005-11-08  0:30 ` hp at gcc dot gnu dot org
2005-11-09  3:45 ` hp at gcc dot gnu dot org
2006-02-15 19:14 ` 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).