[llvm-bugs] [Bug 20934] Redundant memory access in SIMD initialization of small struct

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Apr 23 05:21:48 PDT 2017


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

Simon Pilgrim <llvm-dev at redking.me.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED
                 CC|                            |llvm-dev at redking.me.uk

--- Comment #3 from Simon Pilgrim <llvm-dev at redking.me.uk> ---
Clang 3.5 (-O1) codegen:

func1():                              # @func1()
        subq    $24, %rsp
        xorps   %xmm0, %xmm0
        movaps  %xmm0, (%rsp)
        leaq    (%rsp), %rdi
        callq   test(void const*)
        addq    $24, %rsp
        retq

func2():                              # @func2()
        subq    $24, %rsp
        movups  .L_ZZ5func2vE4Bits(%rip), %xmm0
        movaps  %xmm0, (%rsp)
        leaq    (%rsp), %rdi
        callq   test(void const*)
        addq    $24, %rsp
        retq

.L_ZZ5func2vE4Bits:
        .quad   0                       # 0x0
        .long   0                       # 0x0
        .zero   4

This was fixed in Clang 3.6:

func1():                              # @func1()
        subq    $24, %rsp
        xorps   %xmm0, %xmm0
        movaps  %xmm0, (%rsp)
        leaq    (%rsp), %rdi
        callq   test(void const*)
        addq    $24, %rsp
        retq

func2():                              # @func2()
        subq    $24, %rsp
        xorps   %xmm0, %xmm0
        movaps  %xmm0, (%rsp)
        leaq    (%rsp), %rdi
        callq   test(void const*)
        addq    $24, %rsp
        retq

And by clang trunk (r301105) has also avoided that unnecessary LEA:

func1():                              # @func1()
        subq    $24, %rsp
        xorps   %xmm0, %xmm0
        movaps  %xmm0, (%rsp)
        movq    %rsp, %rdi
        callq   test(void const*)
        addq    $24, %rsp
        retq

func2():                              # @func2()
        subq    $24, %rsp
        xorps   %xmm0, %xmm0
        movaps  %xmm0, (%rsp)
        movq    %rsp, %rdi
        callq   test(void const*)
        addq    $24, %rsp
        retq

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170423/c4047a6d/attachment.html>


More information about the llvm-bugs mailing list