[LLVMbugs] [Bug 5501] Useless memory accesses removal from loops

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Sat Nov 28 17:26:46 PST 2009


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


Chris Lattner <clattner at apple.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




--- Comment #16 from Chris Lattner <clattner at apple.com>  2009-11-28 19:26:46 ---
I implemented this on mainline.  Before, we compile the inner loop of SOR in
scimark to 5 loads and one store:

LBB2_6:                                                     ## %bb2
        movsd   8(%r10,%rbx,8), %xmm3
        movapd  %xmm1, %xmm2
        mulsd   8(%r11,%rbx,8), %xmm2
        addsd   8(%r9,%rbx,8), %xmm3
        addsd   (%r11,%rbx,8), %xmm3
        addsd   16(%r11,%rbx,8), %xmm3
        mulsd   %xmm0, %xmm3
        addsd   %xmm2, %xmm3
        movsd   %xmm3, 8(%r11,%rbx,8)
        incq    %rbx
        cmpq    %rsi, %rbx
        jne     LBB2_6

now we compile it to 3 loads and one store:

LBB2_6:                                                     ## %bb2
        movsd   8(%r10,%rbx,8), %xmm5
        movsd   16(%r11,%rbx,8), %xmm4
        mulsd   %xmm1, %xmm3
        addsd   8(%r9,%rbx,8), %xmm5
        addsd   %xmm2, %xmm5
        addsd   %xmm4, %xmm5
        mulsd   %xmm0, %xmm5
        addsd   %xmm5, %xmm3
        movsd   %xmm3, 8(%r11,%rbx,8)
        incq    %rbx
        movapd  %xmm3, %xmm2
        movapd  %xmm4, %xmm3
        cmpq    %rsi, %rbx
        jne     LBB2_6

The loop in question is ultiSource/Benchmarks/SciMark2-C/SOR.c:

                for (j=1; j<Nm1; j++)
                    Gi[j] = omega_over_four * (Gim1[j] + Gip1[j] + Gi[j-1] 
                                + Gi[j+1]) + one_minus_omega * Gi[j];


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