[LLVMbugs] [Bug 8569] New: Missing assertion propagation

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Nov 8 17:09:05 PST 2010


http://llvm.org/bugs/show_bug.cgi?id=8569

           Summary: Missing assertion propagation
           Product: new-bugs
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Keywords: quality-of-implementation
          Severity: normal
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: xinliangli at gmail.com
                CC: llvmbugs at cs.uiuc.edu, xinliangli at gmail.com


Trivial Test:

int g;
int foo (int i)
{

   if (i == 1)
   {
      g = i + 1;
   }
   else if (i == 10)
      g = 2*i;

  return g;
}

Clang -O2 -fomit-frame-pointer generates:


foo:
.Leh_func_begin0:
    cmpl    $1, %edi
    je    .LBB0_3
    cmpl    $10, %edi
    je    .LBB0_4
    movl    g(%rip), %eax
    ret
.LBB0_3:
    incl    %edi               <---
    movl    %edi, g(%rip)      <---
    movl    $2, %eax
    ret
.LBB0_4:
    addl    %edi, %edi        <---
    movl    %edi, g(%rip)     <---
    movl    $20, %eax
    ret


Compared with gcc -O2 result:


.LFB0:
    .cfi_startproc
    cmpl    $1, %edi
    je    .L6
    cmpl    $10, %edi
    je    .L4
    movl    g(%rip), %eax
    ret
    .p2align 4,,10
    .p2align 3
.L4:
    movl    $20, g(%rip)
    movl    $20, %eax
    ret
    .p2align 4,,10
    .p2align 3
.L6:
    movl    $2, g(%rip)
    movl    $2, %eax
    ret

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list