[Bug rtl-optimization/30643] New: CSE regression

dann at godzilla dot ics dot uci dot edu gcc-bugzilla@gcc.gnu.org
Tue Jan 30 17:07:00 GMT 2007


CSE used to eliminate all the "if"s in the code below at least in gcc-3.x (and
probably even earlier). Now in SVN HEAD it does not do it anymore. 4.1 still
does it. 

struct s {  int a;  int b;};
void bar (struct s *ps,  int *p, int *__restrict__ rp, int *__restrict__ rq)
{
  ps->a = 0;
  ps->b = 1;
  if (ps->a != 0)    abort ();
  p[0] = 0;
  p[1] = 1;
  if (p[0] != 0)     abort ();
  rp[0] = 0;
  rq[0] = 1;
  if (rp[0] != 0)     abort();
}

-O2 assembly for SVN HEAD:
bar:
        subl    $12, %esp
        movl    16(%esp), %eax
        movl    20(%esp), %edx
        movl    24(%esp), %ecx
        movl    $0, (%eax)
        movl    $1, 4(%eax)
        movl    (%eax), %eax
        testl   %eax, %eax
        jne     .L20
        movl    $0, (%edx)
        movl    (%edx), %eax
        movl    $1, 4(%edx)
        testl   %eax, %eax
        jne     .L20
        movl    $0, (%ecx)
        movl    (%ecx), %ecx
        movl    28(%esp), %eax
        testl   %ecx, %ecx
        movl    $1, (%eax)
        jne     .L20
        addl    $12, %esp
        ret
.L20:
        call    abort


-O2 assembly for 4.1.1
bar:
        movl    4(%esp), %eax
        movl    8(%esp), %edx
        movl    $0, (%eax)
        movl    $1, 4(%eax)
        movl    12(%esp), %eax
        movl    $0, (%edx)
        movl    $1, 4(%edx)
        movl    $0, (%eax)
        movl    16(%esp), %eax
        movl    $1, (%eax)
        ret


-- 
           Summary: CSE regression
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dann at godzilla dot ics dot uci dot edu


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



More information about the Gcc-bugs mailing list