public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug other/17101] New: Opportunity to collapse and eliminate loop
@ 2004-08-19 14:59 gcc-bugzilla at gcc dot gnu dot org
  2004-08-19 15:06 ` [Bug other/17101] " pinskia at gcc dot gnu dot org
  2004-11-06 20:36 ` [Bug tree-optimization/17101] " pinskia at gcc dot gnu dot org
  0 siblings, 2 replies; 3+ messages in thread
From: gcc-bugzilla at gcc dot gnu dot org @ 2004-08-19 14:59 UTC (permalink / raw)
  To: gcc-bugs

Description:
A non-optimal code sequence is illustraded.    Duplicate using gcc 3.5 and
command line:

gcc -O3 -m64 -funroll-loops -c test.c


Testcase:
int st;

void foo ()
{

  int i;
  int j;

  for (i=0; i < 10; i++)
    for (j=0; j < 10; j++)
      st = st + j;

}

Assembly:
Code currently generated collapses the outer loop, but not the inner loop:

.foo:
      li 0,10
      ld 11,.LC0@toc(2)
      mtctr 0
.L2:
      lwz 9,0(11)
      addi 9,9,45
      stw 9,0(11)
      bdnz .L2
      blr

Forward store motion could remove the stw from the loop and allow it to
be collapsed to look like this:

 .foo:
       ld 11,.LC0@toc(2)
       lwz 3,0(11)
       addi 9,3,450
       stw 9,0(11)
       blr




-- 
           Summary: Opportunity to collapse and eliminate loop
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P1
         Component: other
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: steinmtz at us dot ibm dot com
                CC: gcc-bugs at gcc dot gnu dot org,steinmtz at us dot ibm
                    dot com
 GCC build triplet: powerpc64-linux
  GCC host triplet: powerpc64-linux
GCC target triplet: powerpc64-linux


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


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

* [Bug other/17101] Opportunity to collapse and eliminate loop
  2004-08-19 14:59 [Bug other/17101] New: Opportunity to collapse and eliminate loop gcc-bugzilla at gcc dot gnu dot org
@ 2004-08-19 15:06 ` pinskia at gcc dot gnu dot org
  2004-11-06 20:36 ` [Bug tree-optimization/17101] " pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-19 15:06 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-08-19 15:06 -------
Confirmed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |missed-optimization
   Last reconfirmed|0000-00-00 00:00:00         |2004-08-19 15:06:47
               date|                            |


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


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

* [Bug tree-optimization/17101] Opportunity to collapse and eliminate loop
  2004-08-19 14:59 [Bug other/17101] New: Opportunity to collapse and eliminate loop gcc-bugzilla at gcc dot gnu dot org
  2004-08-19 15:06 ` [Bug other/17101] " pinskia at gcc dot gnu dot org
@ 2004-11-06 20:36 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-11-06 20:36 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-11-06 20:36 -------
Fixed on the mainline:
        lis r9,ha16(_st)
        lwa r2,lo16(_st)(r9)
        addi r2,r2,450
        stw r2,lo16(_st)(r9)
        blr

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
          Component|rtl-optimization            |tree-optimization
         Resolution|                            |FIXED
   Target Milestone|---                         |4.0.0


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


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

end of thread, other threads:[~2004-11-06 20:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-19 14:59 [Bug other/17101] New: Opportunity to collapse and eliminate loop gcc-bugzilla at gcc dot gnu dot org
2004-08-19 15:06 ` [Bug other/17101] " pinskia at gcc dot gnu dot org
2004-11-06 20:36 ` [Bug tree-optimization/17101] " 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).