[llvm-bugs] [Bug 38241] New: Opportunity to skip dereferencie and move

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jul 20 00:49:33 PDT 2018


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

            Bug ID: 38241
           Summary: Opportunity to skip dereferencie and move
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: david.bolvansky at gmail.com
                CC: llvm-bugs at lists.llvm.org

Code:
typedef struct X {
    int *p;
    int *q;
} example_t;

int foo(example_t *e, int x) {
    *e->p = x;
    example_t c = *e;
    return *c.p;
}

Clang trunk -O3
foo(X*, int):                             # @foo(X*, int)
        mov     rax, qword ptr [rdi]
        mov     dword ptr [rax], esi
        mov     rax, qword ptr [rdi]
        mov     eax, dword ptr [rax]
        ret

GGC trunk
foo(X*, int):
        mov     rdx, QWORD PTR [rdi]
        mov     eax, esi
        mov     DWORD PTR [rdx], esi
        ret

-- 
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/20180720/2c9d7ca8/attachment-0001.html>


More information about the llvm-bugs mailing list