[llvm-bugs] [Bug 38242] New: Missed chance for auto vectorization

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jul 20 00:59:55 PDT 2018


            Bug ID: 38242
           Summary: Missed chance for auto vectorization
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Loop Optimizer
          Assignee: unassignedbugs at nondot.org
          Reporter: david.bolvansky at gmail.com
                CC: llvm-bugs at lists.llvm.org

typedef struct {
    int *arr;
    unsigned size;
} attr_t;

int foo(attr_t *e, int x) {
    int s = e->size;
    for (unsigned i = 0; i < s; ++i) {
        e->arr[i] = i + x;

Clang -O3
foo(attr_t*, int):                        
        mov     rax, qword ptr [rdi]
        xor     ecx, ecx
        lea     edx, [rsi + rcx]
        mov     edi, ecx
        mov     dword ptr [rax + 4*rdi], edx
        add     ecx, 1
        jmp     .LBB0_1

GCC can vectorize it well.


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/01163789/attachment.html>

More information about the llvm-bugs mailing list