public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/17640] New: empty loop not removed after optimization
@ 2004-09-23 21:13 wouter dot vermaelen at pi dot be
  2004-09-23 23:01 ` [Bug c/17640] " pinskia at gcc dot gnu dot org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: wouter dot vermaelen at pi dot be @ 2004-09-23 21:13 UTC (permalink / raw)
  To: gcc-bugs

gcc can optimize this program quite well. However the remaining empty loop is a 
bit silly.  
  
 
int f() { return 1; }  
  
int main() {  
  int a = 0;  
  for (int i = 0; i < 100; ++i) {  
    a += f();  
  }  
  return a;  
}  
 
 
> gcc loop.c -O3 -S 
  
main:   pushl   %ebp  
        movl    %esp, %ebp  
        subl    $8, %esp  
        andl    $-16, %esp  
        subl    $16, %esp  
        movl    $99, %eax  
.L7:    decl    %eax  
        jns     .L7  
        movl    $100, %eax  
        leave  
        ret

-- 
           Summary: empty loop not removed after optimization
           Product: gcc
           Version: 3.4.2
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: wouter dot vermaelen at pi dot be
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug c/17640] empty loop not removed after optimization
  2004-09-23 21:13 [Bug c/17640] New: empty loop not removed after optimization wouter dot vermaelen at pi dot be
@ 2004-09-23 23:01 ` pinskia at gcc dot gnu dot org
  2004-09-23 23:05 ` [Bug tree-optimization/17640] " pinskia at gcc dot gnu dot org
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-09-23 23:01 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-09-23 23:01 -------
Confirmed but not the documentation says we don't want this but that has changed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2004-09-23 23:01:45
               date|                            |


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


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

* [Bug tree-optimization/17640] empty loop not removed after optimization
  2004-09-23 21:13 [Bug c/17640] New: empty loop not removed after optimization wouter dot vermaelen at pi dot be
  2004-09-23 23:01 ` [Bug c/17640] " pinskia at gcc dot gnu dot org
@ 2004-09-23 23:05 ` pinskia at gcc dot gnu dot org
  2004-12-24  2:26 ` pinskia at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-09-23 23:05 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c                           |tree-optimization
           Keywords|                            |missed-optimization
   Last reconfirmed|2004-09-23 23:01:45         |2004-09-23 23:05:03
               date|                            |


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


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

* [Bug tree-optimization/17640] empty loop not removed after optimization
  2004-09-23 21:13 [Bug c/17640] New: empty loop not removed after optimization wouter dot vermaelen at pi dot be
  2004-09-23 23:01 ` [Bug c/17640] " pinskia at gcc dot gnu dot org
  2004-09-23 23:05 ` [Bug tree-optimization/17640] " pinskia at gcc dot gnu dot org
@ 2004-12-24  2:26 ` pinskia at gcc dot gnu dot org
  2005-01-28 14:26 ` rguenth at tat dot physik dot uni-tuebingen dot de
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-12-24  2:26 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-12-24 02:26 -------
*** Bug 18648 has been marked as a duplicate of this bug. ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pluto at pld-linux dot org


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


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

* [Bug tree-optimization/17640] empty loop not removed after optimization
  2004-09-23 21:13 [Bug c/17640] New: empty loop not removed after optimization wouter dot vermaelen at pi dot be
                   ` (2 preceding siblings ...)
  2004-12-24  2:26 ` pinskia at gcc dot gnu dot org
@ 2005-01-28 14:26 ` rguenth at tat dot physik dot uni-tuebingen dot de
  2005-01-28 15:18 ` steven at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at tat dot physik dot uni-tuebingen dot de @ 2005-01-28 14:26 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rguenth at tat dot physik dot uni-tuebingen dot de  2005-01-28 14:26 -------
One patch for empty-loop removal was posted here by Zdenek
http://gcc.gnu.org/ml/gcc-patches/2004-07/msg01679.html

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rguenth at tat dot physik
                   |                            |dot uni-tuebingen dot de


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


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

* [Bug tree-optimization/17640] empty loop not removed after optimization
  2004-09-23 21:13 [Bug c/17640] New: empty loop not removed after optimization wouter dot vermaelen at pi dot be
                   ` (3 preceding siblings ...)
  2005-01-28 14:26 ` rguenth at tat dot physik dot uni-tuebingen dot de
@ 2005-01-28 15:18 ` steven at gcc dot gnu dot org
  2005-05-11 12:58 ` giovannibajo at libero dot it
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: steven at gcc dot gnu dot org @ 2005-01-28 15:18 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From steven at gcc dot gnu dot org  2005-01-28 15:18 -------
That patch is just gross.  Come on, builtin_maybe_infinite_loop?!

There are better and easier ways to kill dead loops.  Like, a loop
optimizer that simply removes dead loops ;-)


-- 


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


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

* [Bug tree-optimization/17640] empty loop not removed after optimization
  2004-09-23 21:13 [Bug c/17640] New: empty loop not removed after optimization wouter dot vermaelen at pi dot be
                   ` (4 preceding siblings ...)
  2005-01-28 15:18 ` steven at gcc dot gnu dot org
@ 2005-05-11 12:58 ` giovannibajo at libero dot it
  2005-05-11 13:00 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: giovannibajo at libero dot it @ 2005-05-11 12:58 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From giovannibajo at libero dot it  2005-05-11 12:58 -------
This is a most-wanted feature. Are there hope to see a patch landing for 4.1? 
Can the patch that Zdenek posted be updated for 4.1? Even if it's gross is 
surely better than nothing...

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rakdver at gcc dot gnu dot
                   |                            |org, stevenb at suse dot de


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


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

* [Bug tree-optimization/17640] empty loop not removed after optimization
  2004-09-23 21:13 [Bug c/17640] New: empty loop not removed after optimization wouter dot vermaelen at pi dot be
                   ` (5 preceding siblings ...)
  2005-05-11 12:58 ` giovannibajo at libero dot it
@ 2005-05-11 13:00 ` pinskia at gcc dot gnu dot org
  2005-05-11 13:02 ` rguenth at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-11 13:00 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-05-11 13:00 -------
I should note that loops with small constants bounds are now removed on the mainline.

-- 


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


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

* [Bug tree-optimization/17640] empty loop not removed after optimization
  2004-09-23 21:13 [Bug c/17640] New: empty loop not removed after optimization wouter dot vermaelen at pi dot be
                   ` (6 preceding siblings ...)
  2005-05-11 13:00 ` pinskia at gcc dot gnu dot org
@ 2005-05-11 13:02 ` rguenth at gcc dot gnu dot org
  2005-05-11 13:14 ` stevenb at suse dot de
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2005-05-11 13:02 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rguenth at gcc dot gnu dot org  2005-05-11 13:02 -------
Only because they are completely peeled.

-- 


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


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

* [Bug tree-optimization/17640] empty loop not removed after optimization
  2004-09-23 21:13 [Bug c/17640] New: empty loop not removed after optimization wouter dot vermaelen at pi dot be
                   ` (7 preceding siblings ...)
  2005-05-11 13:02 ` rguenth at gcc dot gnu dot org
@ 2005-05-11 13:14 ` stevenb at suse dot de
  2005-05-11 13:16 ` steven at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: stevenb at suse dot de @ 2005-05-11 13:14 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From stevenb at suse dot de  2005-05-11 13:14 -------
Subject: Re:  empty loop not removed after optimization

On Wednesday 11 May 2005 14:58, giovannibajo at libero dot it wrote:
> ------- Additional Comments From giovannibajo at libero dot it  2005-05-11
> 12:58 ------- This is a most-wanted feature. Are there hope to see a patch
> landing for 4.1? Can the patch that Zdenek posted be updated for 4.1? Even
> if it's gross is surely better than nothing...

nothing is better than gross.


-- 


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


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

* [Bug tree-optimization/17640] empty loop not removed after optimization
  2004-09-23 21:13 [Bug c/17640] New: empty loop not removed after optimization wouter dot vermaelen at pi dot be
                   ` (8 preceding siblings ...)
  2005-05-11 13:14 ` stevenb at suse dot de
@ 2005-05-11 13:16 ` steven at gcc dot gnu dot org
  2005-06-30 21:48 ` steven at gcc dot gnu dot org
  2005-07-12  0:01 ` pinskia at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: steven at gcc dot gnu dot org @ 2005-05-11 13:16 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From steven at gcc dot gnu dot org  2005-05-11 13:15 -------
I'll hack up something. 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|stevenb at suse dot de      |
         AssignedTo|unassigned at gcc dot gnu   |steven at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2005-05-07 19:58:03         |2005-05-11 13:15:59
               date|                            |


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


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

* [Bug tree-optimization/17640] empty loop not removed after optimization
  2004-09-23 21:13 [Bug c/17640] New: empty loop not removed after optimization wouter dot vermaelen at pi dot be
                   ` (9 preceding siblings ...)
  2005-05-11 13:16 ` steven at gcc dot gnu dot org
@ 2005-06-30 21:48 ` steven at gcc dot gnu dot org
  2005-07-12  0:01 ` pinskia at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: steven at gcc dot gnu dot org @ 2005-06-30 21:48 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From steven at gcc dot gnu dot org  2005-06-30 21:48 -------
Zdenek has a patch: 
http://gcc.gnu.org/ml/gcc-patches/2005-06/msg02270.html 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|steven at gcc dot gnu dot   |unassigned at gcc dot gnu
                   |org                         |dot org
             Status|ASSIGNED                    |NEW


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


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

* [Bug tree-optimization/17640] empty loop not removed after optimization
  2004-09-23 21:13 [Bug c/17640] New: empty loop not removed after optimization wouter dot vermaelen at pi dot be
                   ` (10 preceding siblings ...)
  2005-06-30 21:48 ` steven at gcc dot gnu dot org
@ 2005-07-12  0:01 ` pinskia at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-12  0:01 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-07-12 00:01 -------
Fixed in 4.1.0.

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


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


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

end of thread, other threads:[~2005-07-12  0:01 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-23 21:13 [Bug c/17640] New: empty loop not removed after optimization wouter dot vermaelen at pi dot be
2004-09-23 23:01 ` [Bug c/17640] " pinskia at gcc dot gnu dot org
2004-09-23 23:05 ` [Bug tree-optimization/17640] " pinskia at gcc dot gnu dot org
2004-12-24  2:26 ` pinskia at gcc dot gnu dot org
2005-01-28 14:26 ` rguenth at tat dot physik dot uni-tuebingen dot de
2005-01-28 15:18 ` steven at gcc dot gnu dot org
2005-05-11 12:58 ` giovannibajo at libero dot it
2005-05-11 13:00 ` pinskia at gcc dot gnu dot org
2005-05-11 13:02 ` rguenth at gcc dot gnu dot org
2005-05-11 13:14 ` stevenb at suse dot de
2005-05-11 13:16 ` steven at gcc dot gnu dot org
2005-06-30 21:48 ` steven at gcc dot gnu dot org
2005-07-12  0:01 ` 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).