public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/27440]  New: [4.0/4.1/4.2 regression] code quality regression due to ivopts
@ 2006-05-04 22:50 dann at godzilla dot ics dot uci dot edu
  2006-05-04 23:04 ` [Bug target/27440] " pinskia at gcc dot gnu dot org
                   ` (20 more replies)
  0 siblings, 21 replies; 22+ messages in thread
From: dann at godzilla dot ics dot uci dot edu @ 2006-05-04 22:50 UTC (permalink / raw)
  To: gcc-bugs

Compiling this code with 3.4.6
void fill2 (unsigned int *arr,  unsigned int val, unsigned int start, unsigned
int limit)
{
  unsigned int i;
  for (i = start; i < start + limit; i++)
    arr[i] = val;
}
generates: 
.L10:
        movl    %ecx, (%ebx,%eax,4)
        incl    %eax
.L8:
        cmpl    %eax, %edx
        ja      .L10
4.0/4.1/4.2 -O2 generate:

.L4:
        incl    %edx
        movl    %esi, (%eax)
        addl    $4, %eax
        cmpl    %ecx, %edx
        jne     .L4
which is both slower and bigger. 

using -O2 -fno-ivopts the result is much better:
.L4:
        movl    %ecx, (%ebx,%eax,4)
        incl    %eax
        cmpl    %edx, %eax
        jb      .L4

The difference in the .final_cleanup dump with and without ivopts is obvious:
With ivopts: 

  void * ivtmp.29;
  unsigned int ivtmp.26;
  unsigned int D.1290;

<bb 0>:
  D.1290 = start + limit;
  if (start < D.1290) goto <L6>; else goto <L2>;

<L6>:;
  ivtmp.29 = arr + (unsigned int *) (start * 4);
  ivtmp.26 = 0;

<L0>:;
  MEM[base: (unsigned int *) ivtmp.29] = val;
  ivtmp.26 = ivtmp.26 + 1;
  ivtmp.29 = ivtmp.29 + 4B;
  if (ivtmp.26 != D.1290 - start) goto <L0>; else goto <L2>;

<L2>:;
  return;

Without ivopts:
  unsigned int i;
  unsigned int D.1290;

<bb 0>:
  D.1290 = start + limit;
  if (start < D.1290) goto <L11>; else goto <L2>;

<L11>:;
  i = start;

<L0>:;
  *((unsigned int *) (i * 4) + arr) = val;
  i = i + 1;
  if (i < D.1290) goto <L0>; else goto <L2>;

<L2>:;
  return;


The   "void * ivtmp.29" is created by the ivopts pass. Why is it
a void* when it is known to be assigned to a unsigned int* ? 

Note that loops like the one in this example are quite common. For example in
the assembly for PR8361 there are about 37 "fill" functions with very similar
code (they are intantiations of 2 different templates, but still...)


-- 
           Summary: [4.0/4.1/4.2 regression] code quality regression due to
                    ivopts
           Product: gcc
           Version: 4.0.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dann at godzilla dot ics dot uci dot edu
GCC target triplet: i686-pc-linux-gnu


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


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

end of thread, other threads:[~2010-05-22 18:17 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-05-04 22:50 [Bug tree-optimization/27440] New: [4.0/4.1/4.2 regression] code quality regression due to ivopts dann at godzilla dot ics dot uci dot edu
2006-05-04 23:04 ` [Bug target/27440] " pinskia at gcc dot gnu dot org
2006-05-04 23:09 ` dann at godzilla dot ics dot uci dot edu
2006-05-05 13:10 ` rguenth at gcc dot gnu dot org
2006-06-04 18:50 ` mmitchel at gcc dot gnu dot org
2006-09-13  3:32 ` bangerth at dealii dot org
2006-09-13  4:26 ` pinskia at gcc dot gnu dot org
2006-10-10 14:06 ` rguenth at gcc dot gnu dot org
2006-10-10 14:36 ` rakdver at gcc dot gnu dot org
2006-10-10 14:48 ` uros at kss-loka dot si
2007-02-03 16:55 ` [Bug target/27440] [4.0/4.1/4.2/4.3 " gdr at gcc dot gnu dot org
2007-02-03 20:30 ` pinskia at gcc dot gnu dot org
2007-02-14  9:25 ` mmitchel at gcc dot gnu dot org
2007-11-19 10:07 ` steven at gcc dot gnu dot org
2007-11-20  7:36 ` ubizjak at gmail dot com
2007-11-20  7:37 ` ubizjak at gmail dot com
2008-07-04 21:22 ` [Bug target/27440] [4.2/4.3/4.4 " jsm28 at gcc dot gnu dot org
2009-02-03 16:25 ` bonzini at gnu dot org
2009-03-31 19:36 ` [Bug target/27440] [4.3/4.4/4.5 " jsm28 at gcc dot gnu dot org
2009-08-04 12:34 ` rguenth at gcc dot gnu dot org
2009-12-30 16:40 ` [Bug target/27440] [4.3/4.4 " steven at gcc dot gnu dot org
2010-05-22 18:17 ` rguenth 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).