public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/55860] New: Turn segmented iteration into nested loops
@ 2013-01-03 14:02 glisse at gcc dot gnu.org
  2013-01-03 16:18 ` [Bug tree-optimization/55860] " rguenth at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: glisse at gcc dot gnu.org @ 2013-01-03 14:02 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 55860
           Summary: Turn segmented iteration into nested loops
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: glisse@gcc.gnu.org


Hello,

in the code below (compiled with g++ -O3), replacing L2 with L1 in the goto
lets gcc generate much better code (the loop on iii never tests jkl), whereas
with L2 it performs the redundant test every time. I have no idea how hard it
would be to teach gcc to notice that. This kind of code appears in C++ when we
define an iterator that iterates over the elements of several containers
successively.

void f(int,int);
void g(int n,int m){
  int iii=0;
  int jkl=0;
  while(jkl<n)
  {
L1:
    if(iii<m)
    {
      f(jkl,iii);
      ++iii;
      goto L2;
    }
    else
    {
      ++jkl;
      iii=0;
    }
L2:;
  }
}


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

end of thread, other threads:[~2013-09-20 17:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-03 14:02 [Bug tree-optimization/55860] New: Turn segmented iteration into nested loops glisse at gcc dot gnu.org
2013-01-03 16:18 ` [Bug tree-optimization/55860] " rguenth at gcc dot gnu.org
2013-09-13 22:08 ` law at redhat dot com
2013-09-18 17:11 ` law at redhat dot com
2013-09-20 17:14 ` law at redhat dot com

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).