[llvm-bugs] [Bug 40631] New: Dead store to aliasing bytes not removed on x86-68

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Feb 6 09:41:19 PST 2019


https://bugs.llvm.org/show_bug.cgi?id=40631

            Bug ID: 40631
           Summary: Dead store to aliasing bytes not removed on x86-68
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: glider at google.com
                CC: dvyukov at google.com, kcc at google.com,
                    llvm-bugs at lists.llvm.org

Created attachment 21440
  --> https://bugs.llvm.org/attachment.cgi?id=21440&action=edit
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))

-- 
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/20190206/3373c13a/attachment.html>


More information about the llvm-bugs mailing list