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 target/24647] New: two copies of a constant in two different registers


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


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