<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Dead store to aliasing bytes not removed on x86-68"
   href="https://bugs.llvm.org/show_bug.cgi?id=40631">40631</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Dead store to aliasing bytes not removed on x86-68
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Scalar Optimizations
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>glider@google.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dvyukov@google.com, kcc@google.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=21440" name="attach_21440" title="ip_tables.i">attachment 21440</a> <a href="attachment.cgi?id=21440&action=edit" title="ip_tables.i">[details]</a></span>
ip_tables.i

Compiling the attached repro (a simplified version of
ipv4/netfilter/ip_tables.c from the Linux kernel) as follows:

$ clang  -fno-common     -O2   -ftrivial-auto-var-init=pattern
-enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang     -c
-o ip_tables.i.s ip_tables.i -S -mllvm -print-after-all -O2

produces redundant stores to acpar.hotdrop, acpar.thoff and acpar.fragoff in
the LLVM IR that end up in the object code:

ipt_do_table:                           # @ipt_do_table
        .cfi_startproc
# %bb.0:
        subq    $40, %rsp
        .cfi_def_cfa_offset 48
        movq    (%rdi), %rax
        xorps   %xmm0, %xmm0
        movaps  %xmm0, (%rsp)
        movaps  %xmm0, 16(%rsp)
        movq    $0, 32(%rsp)
        movaps  .LCPI0_0(%rip), %xmm0   # xmm0 =
[12297829382473034410,12297829382473034410]
        movaps  %xmm0, (%rsp)
        movabsq $-6148914691236517206, %rcx # imm = 0xAAAAAAAAAAAAAAAA
        movq    %rcx, 16(%rsp)
        movq    %rcx, 24(%rsp)
        movb    $-86, 32(%rsp)
        movzwl  2(%rax), %ecx
        andl    $8191, %ecx             # imm = 0x1FFF
        movl    %ecx, 24(%rsp)
        movzbl  (%rax), %eax
        andl    $15, %eax
        movl    %eax, 28(%rsp)
        movb    $0, 32(%rsp)

(see the stores to 32(%rsp), 28(%rsp) and 24(%rsp))</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>