The attached source is a loop+switch statement, where only some of the switch
cases change the variable 'val'. 4.4 generates moves for it in every case, even
the ones where it's not mentioned, while 4.2 didn't; the difference is visible
in tree dumps.

This part:
            case Op_Inc1: (*tape)++; break;

with 4.2 at -O:

<L3>:;
  *tape = *tape + 1;
  goto <bb 3> (<L0>);

L5:
        incb    (%edx)
        jmp     L13

SVN at -O:
<L3>:;
  *tape.17 = *tape.17 + 1;
  val.16 = val;
  goto <bb 3> (<L10>);

L6:
        incb    (%esi)
        movl    %edx, %eax
        jmp     L10

Suprisingly, -O3 is worse:
L6:
        movl    %edx, %eax
        incb    (%esi)
        movl    %eax, %edx
        jmp     L2

IRA doesn't improve it.
This isn't from real-world code, so it's not really important, but I'd like to
make a code-copying VM out of this.


-- 
           Summary: [4.4 regression] Unnecessary moves generated on loop
                    boundaries
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: astrange at ithinksw dot com
GCC target triplet: i?86-*-*


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

Reply via email to