[Bug target/24647] New: two copies of a constant in two different registers

pinskia at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Thu Nov 3 01:15:00 GMT 2005


Take the following code:
int f(void)
{
  static int i;
  int i1;
  i1 = i;
  if (i1 == 0)
    i = i1 = 2;
  return i1;
}
----
Currently we generate:
f:
    movl i.1285, %eax
    pushl   %ebp
    movl %esp, %ebp
    testl   %eax, %eax
    jne .L7
    movl $2, %ecx
    movl $2, %eax
    movl %ecx, i.1285
.L7:
    popl %ebp
    ret


Why is 2 in two different registers (I think the issue here is really a target
issue)?  But should postreload CSE detect this or postreload GCSE?


-- 
           Summary: two copies of a constant in two different registers
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pinskia at gcc dot gnu dot org
GCC target triplet: i686-pc-linux-gnu


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



More information about the Gcc-bugs mailing list