[LLVMbugs] [Bug 9961] New: missing simple store merging

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu May 19 22:36:25 PDT 2011


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

           Summary: missing simple store merging
           Product: new-bugs
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: nicholas at mxc.ca
                CC: llvmbugs at cs.uiuc.edu


I wrote the equivalent to this sequence in a function:

  void test(char *ptr) {
    ptr[0] = 0;
    ptr[1] = 0;
  }

and was surprised to see that at -O2, we emit two movb instructions:

        movb    $0, (%rdi)
        movb    $0, 1(%rdi)
        ret

I was really expecting a single movw. Now, gcc 4.5.2 does the exact same thing,
so maybe there's a good reason for this? It sure looks like a missed optz'n to
me.

On x86-32, four ptr[x] = 0 lines will merge into a single movl in llvm but not
in gcc. It doesn't happen in x86-64.

-- 
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