public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/46281] New: Inefficient unswitching (too many copies)
@ 2010-11-02 22:23 davidxl at gcc dot gnu.org
  2010-11-03 11:00 ` [Bug tree-optimization/46281] " rguenth at gcc dot gnu.org
  2021-07-26  9:34 ` pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: davidxl at gcc dot gnu.org @ 2010-11-02 22:23 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: Inefficient unswitching (too many copies)
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: davidxl@gcc.gnu.org


Compiling the following program with -O3:

extern int gen_int(int);
extern void ref_int_p(int*);

void kernel3 ()
{
  int i;
  int j;
  int k;
  int l;
  int m;
  int a[200];

  j = gen_int (0);
  k = gen_int (0);
  l = gen_int (0);
  m = gen_int (0);

  for (i = 0; i < 200; i++)
    {
      if (j < k || j < l || j < m ) // || j << 3 || k << 4)
        a[i] = 1;
      else
        a[i] -= j;
    }

  ref_int_p (&a[0]);

  return;
}


Gcc unswitches the loop, but generate three copies of the loop -- it should
only generate 2 copies.

LLVM correctly generates two copies.

David


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

end of thread, other threads:[~2021-07-26  9:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-02 22:23 [Bug tree-optimization/46281] New: Inefficient unswitching (too many copies) davidxl at gcc dot gnu.org
2010-11-03 11:00 ` [Bug tree-optimization/46281] " rguenth at gcc dot gnu.org
2021-07-26  9:34 ` pinskia at gcc dot gnu.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).