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 rtl-optimization/31799] New: Failed to optimize out test instruction


For

void
foo (int x, int *y, int *z)
{
  *z = ++x;
  if (x != 0)
  *y = 1;
}

gcc 4.3 generates

foo:
.LFB2:
        addl    $1, %edi
        testl   %edi, %edi
        movl    %edi, (%rdx)
        je      .L3
        movl    $1, (%rsi)
.L3:
        rep ; ret

But "testl   %edi, %edi" isn't needed since "addl    $1, %edi" sets proper
FLAGS_REG.


-- 
           Summary: Failed to optimize out test instruction
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: hjl at lucon dot org
GCC target triplet: x86_64-unknown-linux-gnu


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


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