[llvm-bugs] [Bug 46479] New: Missed optimization: movups instruction is used even when the memory is known to be aligned

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Jun 27 09:58:12 PDT 2020


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

            Bug ID: 46479
           Summary: Missed optimization: movups instruction is used even
                    when the memory is known to be aligned
           Product: libraries
           Version: 10.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: josephcsible at gmail.com
                CC: craig.topper at gmail.com, llvm-bugs at lists.llvm.org,
                    llvm-dev at redking.me.uk, spatel+llvm at rotateright.com

Consider this C code:

extern struct foo {
    long x, y, z;
} s;

void f(struct foo);

void g(void) {
    f(s);
}

At -O3, clang compiles it into this:

g:
        subq    $24, %rsp
        movq    s+16(%rip), %rax
        movq    %rax, 16(%rsp)
        movups  s(%rip), %xmm0
        movups  %xmm0, (%rsp)
        callq   f
        addq    $24, %rsp
        retq

Because of ABI requirements, the stack pointer must be 16-byte aligned right
before "callq f", so the second "movups" can instead be a "movaps".

-- 
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/20200627/8128e44d/attachment-0001.html>


More information about the llvm-bugs mailing list