[LLVMbugs] [Bug 11032] New: Dead store elimination deficient

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Sep 28 09:38:06 PDT 2011


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

           Summary: Dead store elimination deficient
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Scalar Optimizations
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: pickensd at synopsys.com
                CC: llvmbugs at cs.uiuc.edu


Given the following test case:


int foo(int *p){
    static int x = 0;
    x++;
    *p = 1;
    x++;
    return x;
}


dead store elimination fails to observe that the assignment into "*p" cannot
possibly affect "x" because the address of "x" is never taken. Thus, LLVM
generates an unnecessary store into "x" and an unnecessary reload of "x". GCC
does not generate the extra code.

This issue affects the performance and code size of the EEMBC "matrix01"
benchmark.

Here is the ARM output at -O3 that demonstrates the problem:


        ldr     r1, .LCPI0_0    <-- address of "x"
        mov     r3, #1
        ldr     r2, [r1]
        add     r2, r2, #1
        str     r2, [r1]      <--- Unnecessary store into "x"
        str     r3, [r0]
        ldr     r0, [r1]      <--- Unnecessary reload of "x"
        add     r0, r0, #1
        str     r0, [r1]
        mov     pc, lr

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