<html>
    <head>
      <base href="http://bugs.llvm.org/">
    </head>
    <body><span class="vcard"><a class="email" href="mailto:llvm-dev@redking.me.uk" title="Simon Pilgrim <llvm-dev@redking.me.uk>"> <span class="fn">Simon Pilgrim</span></a>
</span> changed
          <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - Redundant memory access in SIMD initialization of small struct"
   href="http://bugs.llvm.org/show_bug.cgi?id=20934">bug 20934</a>
          <br>
             <table border="1" cellspacing="0" cellpadding="8">
          <tr>
            <th>What</th>
            <th>Removed</th>
            <th>Added</th>
          </tr>

         <tr>
           <td style="text-align:right;">Resolution</td>
           <td>---
           </td>
           <td>FIXED
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">Status</td>
           <td>NEW
           </td>
           <td>RESOLVED
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">CC</td>
           <td>
                
           </td>
           <td>llvm-dev@redking.me.uk
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - Redundant memory access in SIMD initialization of small struct"
   href="http://bugs.llvm.org/show_bug.cgi?id=20934#c3">Comment # 3</a>
              on <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - Redundant memory access in SIMD initialization of small struct"
   href="http://bugs.llvm.org/show_bug.cgi?id=20934">bug 20934</a>
              from <span class="vcard"><a class="email" href="mailto:llvm-dev@redking.me.uk" title="Simon Pilgrim <llvm-dev@redking.me.uk>"> <span class="fn">Simon Pilgrim</span></a>
</span></b>
        <pre>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</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>