This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/21883] New: tree-ssa-dom.c causing excessive code duplication


extern int foo1 (void), foo2 (int);

int bar (int x)
{
  int varvar1, varvar2;
  int z;
  if (x > 913)
    varvar1 = foo1 ();
  else
    varvar2 = foo2 (6);
#define A foo1 (); foo1 (); foo1 (); foo1 (); foo1 ();
#define B A A A A A A A A A A
#define C B B B B B B B B B B
  C C C C C C C C C C C
  if (x > 913)
    z = varvar1 + foo1 ();
  else
    z = varvar2 + foo2 (6);
  return z;
}

Current HEAD will duplicate all the 2500 foo1 () calls to save a if (x > 913)
comparison.  With -Os almost no duplication should be allowed (only if the
duplicated instructions are expected to be shorter than the compare and branch),
and even with -O2 there should be some sensible limit.

-- 
           Summary: tree-ssa-dom.c causing excessive code duplication
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jakub at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]